motion-stylez 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -2
- data/app/controllers/my_controller.rb +17 -1
- data/app/stylesheets/my_stylesheet.rb +4 -1
- data/lib/motion-stylez/base.rb +4 -2
- data/lib/motion-stylez/ext.rb +10 -0
- data/lib/motion-stylez/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f8797b0e4df562325248ec08b7ad42411ac405e
|
4
|
+
data.tar.gz: ae916a2e3e4d528e6bd736586f0f3e94812086ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efde06b84dde2cda288c425aefa33b3d981f83b8d7e89608a8635d09e719c08ccdb574a44ac8cb4b4f64646822426105a3714c920abe2a1d78fff2c82ef8f43d
|
7
|
+
data.tar.gz: 63fc49ce7fa6546b7b0f64cad3788f80f034b76e0b22df2110f2cb40b810cd3d5a9d26c4e29506947c3b111950ce2fc996042e34c146ffddf2294133c83e9291
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# motion-stylez (z)
|
2
2
|
|
3
3
|
A super basic RubyMotion stylesheet library based off Todd Werth's [RMQ library](https://github.com/infinitered/rmq) that lets you centralize your view styles.
|
4
4
|
|
@@ -41,6 +41,10 @@ class MyStylesheet
|
|
41
41
|
def white_bg(v)
|
42
42
|
v.backgroundColor = UIColor.whiteColor
|
43
43
|
end
|
44
|
+
|
45
|
+
def blue_bg(v)
|
46
|
+
v.backgroundColor = UIColor.blueColor
|
47
|
+
end
|
44
48
|
end
|
45
49
|
```
|
46
50
|
|
@@ -56,7 +60,8 @@ class MyViewController < UIViewController
|
|
56
60
|
z(self.view, :white_bg)
|
57
61
|
|
58
62
|
self.view.addSubview(z(UILabel, :bw_big) do |v|
|
59
|
-
v.text = "
|
63
|
+
v.text = ":bw_big"
|
64
|
+
v.frame = [[20, 40], [280, 50]]
|
60
65
|
end)
|
61
66
|
|
62
67
|
# OR YOU CAN DO THE LONG WAY
|
@@ -65,6 +70,21 @@ class MyViewController < UIViewController
|
|
65
70
|
# self.view.addSubview(z(UILabel).style(:bw_big) do |v|
|
66
71
|
# v.text = "Testing"
|
67
72
|
# end)
|
73
|
+
|
74
|
+
self.view.addSubview(z(UILabel, [:bw_big, :blue_bg]) do |v|
|
75
|
+
v.text = ":bw_big & :blue_bg"
|
76
|
+
v.frame = [[20, 100], [280, 50]]
|
77
|
+
end)
|
78
|
+
|
79
|
+
self.view.addSubview(UILabel.new.style([:bw_big, :blue_bg]) do |v|
|
80
|
+
v.text = "alt sytax 1"
|
81
|
+
v.frame = [[20, 160], [280, 50]]
|
82
|
+
end)
|
83
|
+
|
84
|
+
self.view.addSubview(UILabel.style([:bw_big, :blue_bg]) do |v|
|
85
|
+
v.text = "alt sytax 2"
|
86
|
+
v.frame = [[20, 220], [280, 50]]
|
87
|
+
end)
|
68
88
|
|
69
89
|
end
|
70
90
|
end
|
@@ -7,7 +7,8 @@ class MyViewController < UIViewController
|
|
7
7
|
z(self.view, :white_bg)
|
8
8
|
|
9
9
|
self.view.addSubview(z(UILabel, :bw_big) do |v|
|
10
|
-
v.text = "
|
10
|
+
v.text = ":bw_big"
|
11
|
+
v.frame = [[20, 40], [280, 50]]
|
11
12
|
end)
|
12
13
|
|
13
14
|
# OR YOU CAN DO THE LONG WAY
|
@@ -16,6 +17,21 @@ class MyViewController < UIViewController
|
|
16
17
|
# self.view.addSubview(z(UILabel).style(:bw_big) do |v|
|
17
18
|
# v.text = "Testing"
|
18
19
|
# end)
|
20
|
+
|
21
|
+
self.view.addSubview(z(UILabel, [:bw_big, :blue_bg]) do |v|
|
22
|
+
v.text = ":bw_big & :blue_bg"
|
23
|
+
v.frame = [[20, 100], [280, 50]]
|
24
|
+
end)
|
25
|
+
|
26
|
+
self.view.addSubview(UILabel.new.style([:bw_big, :blue_bg]) do |v|
|
27
|
+
v.text = "alt sytax 1"
|
28
|
+
v.frame = [[20, 160], [280, 50]]
|
29
|
+
end)
|
30
|
+
|
31
|
+
self.view.addSubview(UILabel.style([:bw_big, :blue_bg]) do |v|
|
32
|
+
v.text = "alt sytax 2"
|
33
|
+
v.frame = [[20, 220], [280, 50]]
|
34
|
+
end)
|
19
35
|
|
20
36
|
end
|
21
37
|
end
|
@@ -3,11 +3,14 @@ class MyStylesheet
|
|
3
3
|
v.backgroundColor = UIColor.blackColor
|
4
4
|
v.textColor = UIColor.whiteColor
|
5
5
|
v.font = UIFont.systemFontOfSize(36)
|
6
|
-
v.frame = [[20, 40], [280, 50]]
|
7
6
|
v.textAlignment = UITextAlignmentCenter
|
8
7
|
end
|
9
8
|
|
10
9
|
def white_bg(v)
|
11
10
|
v.backgroundColor = UIColor.whiteColor
|
12
11
|
end
|
12
|
+
|
13
|
+
def blue_bg(v)
|
14
|
+
v.backgroundColor = UIColor.blueColor
|
15
|
+
end
|
13
16
|
end
|
data/lib/motion-stylez/base.rb
CHANGED
@@ -7,13 +7,15 @@ module MotionStylez
|
|
7
7
|
@shared
|
8
8
|
end
|
9
9
|
|
10
|
-
def style(
|
10
|
+
def style(style_names)
|
11
11
|
begin
|
12
12
|
puts "\[STYLEZ ERROR] no stylesheet selected" unless self.stylesheet
|
13
13
|
|
14
14
|
view = self.selector
|
15
15
|
view = view.new if view.class == Class
|
16
|
-
|
16
|
+
[style_names].flatten.each do |style|
|
17
|
+
self.stylesheet.public_send(style, view)
|
18
|
+
end
|
17
19
|
yield view if block_given?
|
18
20
|
view
|
19
21
|
rescue NoMethodError => e
|
data/lib/motion-stylez/ext.rb
CHANGED