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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7adeb8a4e78398e355f82e73e2a4836faafc727b
4
- data.tar.gz: 74a11290ba45c6871375d84c29ff7f4f042647c8
3
+ metadata.gz: 0f8797b0e4df562325248ec08b7ad42411ac405e
4
+ data.tar.gz: ae916a2e3e4d528e6bd736586f0f3e94812086ac
5
5
  SHA512:
6
- metadata.gz: 409cc331153fcd494cd611d1e672d73e36e340eb9e3dfd3e10fb3d40bb84c568fa299fa7c7065b159290a9fcbc520a28c5579f7d138a9eb1716b25e78553fcd9
7
- data.tar.gz: d4c43cc76f93db93b02b7f7fbc26032c6710c89807eb482ff3600d47fb46dbdeb46519ccbdb33c0067604fa0ee9b919fbd1d30d5be71344e6519068216269d9d
6
+ metadata.gz: efde06b84dde2cda288c425aefa33b3d981f83b8d7e89608a8635d09e719c08ccdb574a44ac8cb4b4f64646822426105a3714c920abe2a1d78fff2c82ef8f43d
7
+ data.tar.gz: 63fc49ce7fa6546b7b0f64cad3788f80f034b76e0b22df2110f2cb40b810cd3d5a9d26c4e29506947c3b111950ce2fc996042e34c146ffddf2294133c83e9291
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Motion::Stylez
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 = "Testing"
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 = "Testing"
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
@@ -7,13 +7,15 @@ module MotionStylez
7
7
  @shared
8
8
  end
9
9
 
10
- def style(style_name)
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
- self.stylesheet.public_send(style_name, view)
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
@@ -7,4 +7,14 @@ class Object
7
7
  MotionStylez::Base.shared
8
8
  end
9
9
  end
10
+ end
11
+
12
+ class UIView
13
+ def self.style(style, &block)
14
+ z(self, style, &block)
15
+ end
16
+
17
+ def style(style, &block)
18
+ z(self, style, &block)
19
+ end
10
20
  end
@@ -1,3 +1,3 @@
1
1
  module MotionStylez
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-stylez
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Dean Watson-Hamblin