sugarcube 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.travis.yml +4 -2
- data/Gemfile.lock +1 -1
- data/README.md +29 -2
- data/lib/sugarcube/version.rb +1 -1
- data/lib/sugarcube-animations/uiview.rb +2 -0
- data/lib/sugarcube-attributedstring/nsattributedstring.rb +9 -5
- data/lib/sugarcube-constants/symbol.rb +21 -0
- data/lib/sugarcube-factories/uibarbuttonitem.rb +34 -30
- data/lib/sugarcube-factories/uitabbaritem.rb +89 -0
- data/lib/sugarcube-foundation/nsstring.rb +8 -0
- data/lib/sugarcube-uikit/uiview.rb +20 -4
- data/spec/nsstring_spec.rb +4 -0
- data/spec/uitabbaritem_spec.rb +114 -0
- data/spec/uiview_spec.rb +30 -0
- metadata +12 -20
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6716fc5629e9a81b77ea3b82a3ad2b17ca33bef3
|
4
|
+
data.tar.gz: 8a3117abdb7192610107153219896869399ae9d7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 64dd9520c3f692e884870bb9071271e1e4886f2e685b90c1cab63b984735af6857d783c224d9474180f18280e84fa9c3df5b27bb8c8c05158fabe62af088da5a
|
7
|
+
data.tar.gz: 8bc745f50a2b2f29a87f6b7c7caadfe8a854cf79ec971095f01baa81c0de05c8529dd68145863336b238509f8079727746b44c425608348d4e348ece8efc2e56
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -814,6 +814,32 @@ toolbar.items = [
|
|
814
814
|
]
|
815
815
|
```
|
816
816
|
|
817
|
+
###### UITabBarItem
|
818
|
+
|
819
|
+
Easy to create system or custom `UITabBarItem`s.
|
820
|
+
|
821
|
+
```ruby
|
822
|
+
UITabBarItem.titled('My Title')
|
823
|
+
# with optional :image and :selected_image options:
|
824
|
+
UITabBarItem.titled('My Title', image: 'my_icon', selected_image: 'my_icon_selected')
|
825
|
+
# also supports :tag and :badge
|
826
|
+
UITabBarItem.titled('My Title', tag: MY_TABBAR_ITEM, badge: '+1')
|
827
|
+
|
828
|
+
# system items:
|
829
|
+
UITabBarItem.more
|
830
|
+
UITabBarItem.favorites
|
831
|
+
|
832
|
+
# Most of the UITabBarItem init methods accept the UIView#tag, and so there is
|
833
|
+
# support for that in the UITabBarItem factory methods. Defaults to 0. The
|
834
|
+
# :badge option is supported here as well
|
835
|
+
UITabBarItem.featured(tag: MY_TABBAR_ITEM, badge: 10)
|
836
|
+
|
837
|
+
# All of the UITabBarSystemItem helpers delegate to the 'UITabBarItem.system'
|
838
|
+
# method, which you can call direcly as well. It accepts :tag and :badge
|
839
|
+
# options.
|
840
|
+
UITabBarItem.system(:top_rated, tag: MY_ITEM_TAG, badge: 'hi')
|
841
|
+
```
|
842
|
+
|
817
843
|
###### NSError
|
818
844
|
```ruby
|
819
845
|
# usually, NSError.new doesn't work, because the only initializer for NSError
|
@@ -1231,8 +1257,9 @@ index_path.to_a # => [1, 2, ...]
|
|
1231
1257
|
```ruby
|
1232
1258
|
'https://github.com'.nsurl
|
1233
1259
|
'/path/to/file'.fileurl
|
1234
|
-
'https://google.com/search?q=' + 'search terms'.escape_url
|
1235
|
-
'%20'.unescape_url
|
1260
|
+
'https://google.com/search?q=' + 'search terms'.escape_url # => "..?q=search%20terms"
|
1261
|
+
'%20'.unescape_url #=> " "
|
1262
|
+
'nô àccénts!'.remove_accents # => "no accents!"
|
1236
1263
|
```
|
1237
1264
|
|
1238
1265
|
###### NSURL
|
data/lib/sugarcube/version.rb
CHANGED
@@ -365,6 +365,8 @@ class UIView
|
|
365
365
|
right = origin + offset
|
366
366
|
|
367
367
|
animation = CAKeyframeAnimation.animationWithKeyPath(keypath)
|
368
|
+
# sometimes, because of conflicts with CATiming (or something to that
|
369
|
+
# effect), calling 'duration=' results in a compiler or runtime error.
|
368
370
|
animation.send(:'setDuration:', duration)
|
369
371
|
animation.repeatCount = repeat
|
370
372
|
animation.values = [origin, left, right, origin]
|
@@ -42,7 +42,7 @@ end
|
|
42
42
|
|
43
43
|
class NSAttributedString
|
44
44
|
|
45
|
-
def
|
45
|
+
def sugarcube_nsattributedstring_dummy_method
|
46
46
|
# make sure NSAttributedString constants get compiled
|
47
47
|
foo = NSFontAttributeName
|
48
48
|
foo = NSParagraphStyleAttributeName
|
@@ -146,12 +146,16 @@ class NSAttributedString
|
|
146
146
|
retval
|
147
147
|
end
|
148
148
|
|
149
|
-
def nsattributedstring
|
150
|
-
|
149
|
+
def nsattributedstring(attributes=nil)
|
150
|
+
if attributes.nil?
|
151
|
+
self
|
152
|
+
else
|
153
|
+
self.with_attributes(attributes)
|
154
|
+
end
|
151
155
|
end
|
152
156
|
|
153
|
-
def attrd
|
154
|
-
self.nsattributedstring
|
157
|
+
def attrd(attributes=nil)
|
158
|
+
self.nsattributedstring(attributes=nil)
|
155
159
|
end
|
156
160
|
|
157
161
|
def +(attributedstring)
|
@@ -95,6 +95,11 @@ class Symbol
|
|
95
95
|
SugarCube.look_in(self, Symbol.uibarbuttonstyle)
|
96
96
|
end
|
97
97
|
|
98
|
+
def uitabbarsystemitem
|
99
|
+
SugarCube.look_in(self, Symbol.uitabbarsystemitem)
|
100
|
+
end
|
101
|
+
alias uitabbaritem uitabbarsystemitem
|
102
|
+
|
98
103
|
def uibuttontype
|
99
104
|
SugarCube.look_in(self, Symbol.uibuttontype)
|
100
105
|
end
|
@@ -240,6 +245,7 @@ class Symbol
|
|
240
245
|
attr :uibarbuttonitem
|
241
246
|
attr :uibarbuttonitem__deprecated
|
242
247
|
attr :uibarbuttonstyle
|
248
|
+
attr :uitabbarsystemitem
|
243
249
|
|
244
250
|
attr :uibuttontype
|
245
251
|
attr :uicontrolstate
|
@@ -499,6 +505,21 @@ class Symbol
|
|
499
505
|
done: UIBarButtonItemStyleDone
|
500
506
|
}
|
501
507
|
|
508
|
+
@uitabbarsystemitem = {
|
509
|
+
more: UITabBarSystemItemMore,
|
510
|
+
favorites: UITabBarSystemItemFavorites,
|
511
|
+
featured: UITabBarSystemItemFeatured,
|
512
|
+
top_rated: UITabBarSystemItemTopRated,
|
513
|
+
recents: UITabBarSystemItemRecents,
|
514
|
+
contacts: UITabBarSystemItemContacts,
|
515
|
+
history: UITabBarSystemItemHistory,
|
516
|
+
bookmarks: UITabBarSystemItemBookmarks,
|
517
|
+
search: UITabBarSystemItemSearch,
|
518
|
+
downloads: UITabBarSystemItemDownloads,
|
519
|
+
most_recent: UITabBarSystemItemMostRecent,
|
520
|
+
most_viewed: UITabBarSystemItemMostViewed,
|
521
|
+
}
|
522
|
+
|
502
523
|
@uibuttontype = {
|
503
524
|
custom: UIButtonTypeCustom,
|
504
525
|
rounded: UIButtonTypeRoundedRect,
|
@@ -4,122 +4,126 @@ class UIBarButtonItem
|
|
4
4
|
class << self
|
5
5
|
|
6
6
|
def done(&action)
|
7
|
-
sugarcube_barbuttonitem(
|
7
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemDone, action)
|
8
8
|
end
|
9
9
|
|
10
10
|
def cancel(&action)
|
11
|
-
sugarcube_barbuttonitem(
|
11
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemCancel, action)
|
12
12
|
end
|
13
13
|
|
14
14
|
def edit(&action)
|
15
|
-
sugarcube_barbuttonitem(
|
15
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemEdit, action)
|
16
16
|
end
|
17
17
|
|
18
18
|
def save(&action)
|
19
|
-
sugarcube_barbuttonitem(
|
19
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemSave, action)
|
20
20
|
end
|
21
21
|
|
22
22
|
def add(&action)
|
23
|
-
sugarcube_barbuttonitem(
|
23
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemAdd, action)
|
24
24
|
end
|
25
25
|
|
26
|
+
# deprecated
|
26
27
|
def flexiblespace(&action)
|
27
|
-
sugarcube_barbuttonitem(
|
28
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemFlexibleSpace, action)
|
28
29
|
end
|
29
30
|
|
30
31
|
def flexible_space(&action)
|
31
|
-
sugarcube_barbuttonitem(
|
32
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemFlexibleSpace, action)
|
32
33
|
end
|
33
34
|
|
35
|
+
# deprecated
|
34
36
|
def fixedspace(&action)
|
35
|
-
sugarcube_barbuttonitem(
|
37
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemFixedSpace, action)
|
36
38
|
end
|
37
39
|
|
38
40
|
def fixed_space(&action)
|
39
|
-
sugarcube_barbuttonitem(
|
41
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemFixedSpace, action)
|
40
42
|
end
|
41
43
|
|
42
44
|
def compose(&action)
|
43
|
-
sugarcube_barbuttonitem(
|
45
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemCompose, action)
|
44
46
|
end
|
45
47
|
|
46
48
|
def reply(&action)
|
47
|
-
sugarcube_barbuttonitem(
|
49
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemReply, action)
|
48
50
|
end
|
49
51
|
|
50
52
|
def action(&action)
|
51
|
-
sugarcube_barbuttonitem(
|
53
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemAction, action)
|
52
54
|
end
|
53
55
|
|
54
56
|
def organize(&action)
|
55
|
-
sugarcube_barbuttonitem(
|
57
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemOrganize, action)
|
56
58
|
end
|
57
59
|
|
58
60
|
def bookmarks(&action)
|
59
|
-
sugarcube_barbuttonitem(
|
61
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemBookmarks, action)
|
60
62
|
end
|
61
63
|
|
62
64
|
def search(&action)
|
63
|
-
sugarcube_barbuttonitem(
|
65
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemSearch, action)
|
64
66
|
end
|
65
67
|
|
66
68
|
def refresh(&action)
|
67
|
-
sugarcube_barbuttonitem(
|
69
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemRefresh, action)
|
68
70
|
end
|
69
71
|
|
70
72
|
def stop(&action)
|
71
|
-
sugarcube_barbuttonitem(
|
73
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemStop, action)
|
72
74
|
end
|
73
75
|
|
74
76
|
def camera(&action)
|
75
|
-
sugarcube_barbuttonitem(
|
77
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemCamera, action)
|
76
78
|
end
|
77
79
|
|
78
80
|
def trash(&action)
|
79
|
-
sugarcube_barbuttonitem(
|
81
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemTrash, action)
|
80
82
|
end
|
81
83
|
|
82
84
|
def play(&action)
|
83
|
-
sugarcube_barbuttonitem(
|
85
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemPlay, action)
|
84
86
|
end
|
85
87
|
|
86
88
|
def pause(&action)
|
87
|
-
sugarcube_barbuttonitem(
|
89
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemPause, action)
|
88
90
|
end
|
89
91
|
|
90
92
|
def rewind(&action)
|
91
|
-
sugarcube_barbuttonitem(
|
93
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemRewind, action)
|
92
94
|
end
|
93
95
|
|
96
|
+
# deprecated
|
94
97
|
def fastforward(&action)
|
95
|
-
sugarcube_barbuttonitem(
|
98
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemFastForward, action)
|
96
99
|
end
|
97
100
|
|
98
101
|
def fast_forward(&action)
|
99
|
-
sugarcube_barbuttonitem(
|
102
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemFastForward, action)
|
100
103
|
end
|
101
104
|
|
102
105
|
def undo(&action)
|
103
|
-
sugarcube_barbuttonitem(
|
106
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemUndo, action)
|
104
107
|
end
|
105
108
|
|
106
109
|
def redo(&action)
|
107
|
-
sugarcube_barbuttonitem(
|
110
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemRedo, action)
|
108
111
|
end
|
109
112
|
|
113
|
+
# deprecated
|
110
114
|
def pagecurl(&action)
|
111
|
-
sugarcube_barbuttonitem(
|
115
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemPageCurl, action)
|
112
116
|
end
|
113
117
|
|
114
118
|
def page_curl(&action)
|
115
|
-
sugarcube_barbuttonitem(
|
119
|
+
sugarcube_barbuttonitem(UIBarButtonSystemItemPageCurl, action)
|
116
120
|
end
|
117
121
|
|
118
|
-
def titled(title, style =
|
122
|
+
def titled(title, style = UIBarButtonItemStyleBordered, &action)
|
119
123
|
sugarcube_barbuttonitem_with_title(title, style, action)
|
120
124
|
end
|
121
125
|
|
122
|
-
def imaged(image, style =
|
126
|
+
def imaged(image, style = UIBarButtonItemStyleBordered, &action)
|
123
127
|
sugarcube_barbuttonitem_with_image(image, style, action)
|
124
128
|
end
|
125
129
|
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# Factory methods for UITabBarItem. I've never understood why UITabBarItem makes
|
2
|
+
# it so easy to set the view tag, but these methods do not require you to do so.
|
3
|
+
class UITabBarItem
|
4
|
+
|
5
|
+
class << self
|
6
|
+
|
7
|
+
def titled(title, options={})
|
8
|
+
tag = options.fetch(:tag, 0)
|
9
|
+
image = options[:image]
|
10
|
+
badge = options[:badge]
|
11
|
+
if image && image.respond_to?(:uiimage)
|
12
|
+
image = image.uiimage
|
13
|
+
end
|
14
|
+
selected_image = options[:selected_image]
|
15
|
+
if selected_image && selected_image.respond_to?(:uiimage)
|
16
|
+
selected_image = selected_image.uiimage
|
17
|
+
end
|
18
|
+
item = self.alloc.initWithTitle(title, image: image, selectedImage: selected_image)
|
19
|
+
if tag
|
20
|
+
item.tag = tag
|
21
|
+
end
|
22
|
+
if badge
|
23
|
+
item.badgeValue = badge.to_s
|
24
|
+
end
|
25
|
+
return item
|
26
|
+
end
|
27
|
+
|
28
|
+
def system(type, options={})
|
29
|
+
type = type.uitabbarsystemitem if type.respond_to?(:uitabbarsystemitem)
|
30
|
+
tag = options.fetch(:tag, 0)
|
31
|
+
badge = options[:badge]
|
32
|
+
item = self.alloc.initWithTabBarSystemItem(type, tag: tag)
|
33
|
+
if badge
|
34
|
+
item.badgeValue = badge.to_s
|
35
|
+
end
|
36
|
+
return item
|
37
|
+
end
|
38
|
+
|
39
|
+
def more(options={})
|
40
|
+
return self.system(UITabBarSystemItemMore, options)
|
41
|
+
end
|
42
|
+
|
43
|
+
def favorites(options={})
|
44
|
+
return self.system(UITabBarSystemItemFavorites, options)
|
45
|
+
end
|
46
|
+
|
47
|
+
def featured(options={})
|
48
|
+
return self.system(UITabBarSystemItemFeatured, options)
|
49
|
+
end
|
50
|
+
|
51
|
+
def top_rated(options={})
|
52
|
+
return self.system(UITabBarSystemItemTopRated, options)
|
53
|
+
end
|
54
|
+
|
55
|
+
def recents(options={})
|
56
|
+
return self.system(UITabBarSystemItemRecents, options)
|
57
|
+
end
|
58
|
+
|
59
|
+
def contacts(options={})
|
60
|
+
return self.system(UITabBarSystemItemContacts, options)
|
61
|
+
end
|
62
|
+
|
63
|
+
def history(options={})
|
64
|
+
return self.system(UITabBarSystemItemHistory, options)
|
65
|
+
end
|
66
|
+
|
67
|
+
def bookmarks(options={})
|
68
|
+
return self.system(UITabBarSystemItemBookmarks, options)
|
69
|
+
end
|
70
|
+
|
71
|
+
def search(options={})
|
72
|
+
return self.system(UITabBarSystemItemSearch, options)
|
73
|
+
end
|
74
|
+
|
75
|
+
def downloads(options={})
|
76
|
+
return self.system(UITabBarSystemItemDownloads, options)
|
77
|
+
end
|
78
|
+
|
79
|
+
def most_recent(options={})
|
80
|
+
return self.system(UITabBarSystemItemMostRecent, options)
|
81
|
+
end
|
82
|
+
|
83
|
+
def most_viewed(options={})
|
84
|
+
return self.system(UITabBarSystemItemMostViewed, options)
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
@@ -28,4 +28,12 @@ class NSString
|
|
28
28
|
)
|
29
29
|
end
|
30
30
|
|
31
|
+
def remove_accents
|
32
|
+
# removes diacritics by using a lossy conversion
|
33
|
+
ascii = self.dataUsingEncoding(NSASCIIStringEncoding, allowLossyConversion: true)
|
34
|
+
|
35
|
+
# turn it back into a string
|
36
|
+
return NSString.alloc.initWithData(ascii, encoding: NSASCIIStringEncoding)
|
37
|
+
end
|
38
|
+
|
31
39
|
end
|
@@ -109,11 +109,19 @@ class UIView
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def convert_frame_to(destination)
|
112
|
-
return self.
|
112
|
+
return self.convert_rect(CGRectMake(0, 0, self.frame.size.width, self.frame.size.height), to: destination)
|
113
113
|
end
|
114
114
|
|
115
115
|
def convert_frame_from(source)
|
116
|
-
return self.
|
116
|
+
return self.convert_rect(CGRectMake(0, 0, source.frame.size.width, source.frame.size.height), from: source)
|
117
|
+
end
|
118
|
+
|
119
|
+
def convert_rect(rect, to: destination)
|
120
|
+
return self.convertRect(rect, toView: destination)
|
121
|
+
end
|
122
|
+
|
123
|
+
def convert_rect(rect, from: source)
|
124
|
+
return self.convertRect(rect, fromView: source)
|
117
125
|
end
|
118
126
|
|
119
127
|
# Returns the receiver's bounds in the coordinate system of `destination`
|
@@ -127,12 +135,20 @@ class UIView
|
|
127
135
|
return self.convert_origin_to(destination)
|
128
136
|
end
|
129
137
|
|
138
|
+
def convert_point(point, to: destination)
|
139
|
+
return self.convertPoint(point, toView: destination)
|
140
|
+
end
|
141
|
+
|
142
|
+
def convert_point(point, from: source)
|
143
|
+
return self.convertPoint(point, fromView: source)
|
144
|
+
end
|
145
|
+
|
130
146
|
def convert_origin_to(destination)
|
131
|
-
return self.
|
147
|
+
return self.convert_point([0, 0], to: destination)
|
132
148
|
end
|
133
149
|
|
134
150
|
def convert_origin_from(source)
|
135
|
-
return self.
|
151
|
+
return self.convert_point([0, 0], from: source)
|
136
152
|
end
|
137
153
|
|
138
154
|
# Easily get and set a UIView's frame properties
|
data/spec/nsstring_spec.rb
CHANGED
@@ -0,0 +1,114 @@
|
|
1
|
+
describe UITabBarItem do
|
2
|
+
|
3
|
+
it 'should support `titled`' do
|
4
|
+
item = UITabBarItem.titled('title')
|
5
|
+
item.should.be.kind_of(UITabBarItem)
|
6
|
+
item.title.should == 'title'
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should support `titled` with options' do
|
10
|
+
item = UITabBarItem.titled('title',
|
11
|
+
tag: 1,
|
12
|
+
badge: 'test',
|
13
|
+
image: UIImage.imageNamed('little_square'),
|
14
|
+
selected_image: UIImage.imageNamed('little_square'),
|
15
|
+
)
|
16
|
+
item.should.be.kind_of(UITabBarItem)
|
17
|
+
item.title.should == 'title'
|
18
|
+
item.tag.should == 1
|
19
|
+
item.badgeValue.should == 'test'
|
20
|
+
item.image.should.be.kind_of(UIImage)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should support `titled` with sugary options' do
|
24
|
+
item = UITabBarItem.titled('title',
|
25
|
+
tag: 1,
|
26
|
+
badge: 'test',
|
27
|
+
image: 'little_square',
|
28
|
+
selected_image: 'little_square',
|
29
|
+
)
|
30
|
+
item.title.should == 'title'
|
31
|
+
item.tag.should == 1
|
32
|
+
item.badgeValue.should == 'test'
|
33
|
+
item.image.should.be.kind_of(UIImage)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should support `system`' do
|
37
|
+
item = UITabBarItem.system(UITabBarSystemItemMore)
|
38
|
+
item.should.be.kind_of(UITabBarItem)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should support `system` with options' do
|
42
|
+
item = UITabBarItem.system(UITabBarSystemItemMore,
|
43
|
+
tag: 1,
|
44
|
+
badge: 'test',
|
45
|
+
)
|
46
|
+
item.should.be.kind_of(UITabBarItem)
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should support `system` with sugar' do
|
50
|
+
item = UITabBarItem.system(:more)
|
51
|
+
item.should.be.kind_of(UITabBarItem)
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should support `more`' do
|
55
|
+
item = UITabBarItem.more
|
56
|
+
item.should.be.kind_of(UITabBarItem)
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should support `favorites`' do
|
60
|
+
item = UITabBarItem.favorites
|
61
|
+
item.should.be.kind_of(UITabBarItem)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should support `featured`' do
|
65
|
+
item = UITabBarItem.featured
|
66
|
+
item.should.be.kind_of(UITabBarItem)
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should support `top_rated`' do
|
70
|
+
item = UITabBarItem.top_rated
|
71
|
+
item.should.be.kind_of(UITabBarItem)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should support `recents`' do
|
75
|
+
item = UITabBarItem.recents
|
76
|
+
item.should.be.kind_of(UITabBarItem)
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'should support `contacts`' do
|
80
|
+
item = UITabBarItem.contacts
|
81
|
+
item.should.be.kind_of(UITabBarItem)
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'should support `history`' do
|
85
|
+
item = UITabBarItem.history
|
86
|
+
item.should.be.kind_of(UITabBarItem)
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'should support `bookmarks`' do
|
90
|
+
item = UITabBarItem.bookmarks
|
91
|
+
item.should.be.kind_of(UITabBarItem)
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'should support `search`' do
|
95
|
+
item = UITabBarItem.search
|
96
|
+
item.should.be.kind_of(UITabBarItem)
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'should support `downloads`' do
|
100
|
+
item = UITabBarItem.downloads
|
101
|
+
item.should.be.kind_of(UITabBarItem)
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'should support `most_recent`' do
|
105
|
+
item = UITabBarItem.most_recent
|
106
|
+
item.should.be.kind_of(UITabBarItem)
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'should support `most_viewed`' do
|
110
|
+
item = UITabBarItem.most_viewed
|
111
|
+
item.should.be.kind_of(UITabBarItem)
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
data/spec/uiview_spec.rb
CHANGED
@@ -100,6 +100,23 @@ describe "UIView" do
|
|
100
100
|
frame.size.width.should == 60
|
101
101
|
frame.size.height.should == 80
|
102
102
|
end
|
103
|
+
|
104
|
+
it "should convert_rect(to:)" do
|
105
|
+
frame = @view3.convert_rect([[1, 2], [10, 20]], to: @view1)
|
106
|
+
frame.origin.x.should == 21
|
107
|
+
frame.origin.y.should == 12
|
108
|
+
frame.size.width.should == 10
|
109
|
+
frame.size.height.should == 20
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should convert_rect(from:)" do
|
113
|
+
frame = @view1.convert_rect([[1, 2], [10, 20]], from: @view3)
|
114
|
+
frame.origin.x.should == 21
|
115
|
+
frame.origin.y.should == 12
|
116
|
+
frame.size.width.should == 10
|
117
|
+
frame.size.height.should == 20
|
118
|
+
end
|
119
|
+
|
103
120
|
end
|
104
121
|
|
105
122
|
describe "should convert point" do
|
@@ -122,6 +139,19 @@ describe "UIView" do
|
|
122
139
|
point.x.should == 20
|
123
140
|
point.y.should == 10
|
124
141
|
end
|
142
|
+
|
143
|
+
it "should convert_point(to:)" do
|
144
|
+
point = @view3.convert_point([1, 2], to: @view1)
|
145
|
+
point.x.should == 21
|
146
|
+
point.y.should == 12
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should convert_point(:from)" do
|
150
|
+
point = @view1.convert_point([1, 2], from: @view3)
|
151
|
+
point.x.should == 21
|
152
|
+
point.y.should == 12
|
153
|
+
end
|
154
|
+
|
125
155
|
end
|
126
156
|
|
127
157
|
it "should return x" do
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sugarcube
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
5
|
-
prerelease:
|
4
|
+
version: 1.5.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Colin T.A. Gray
|
@@ -12,29 +11,20 @@ authors:
|
|
12
11
|
autorequire:
|
13
12
|
bindir: bin
|
14
13
|
cert_chain: []
|
15
|
-
date: 2014-
|
14
|
+
date: 2014-03-03 00:00:00.000000000 Z
|
16
15
|
dependencies: []
|
17
|
-
description:
|
18
|
-
|
16
|
+
description: |
|
17
|
+
== Description
|
19
18
|
|
20
19
|
CocoaTouch/iOS is a *verbose* framework. These extensions hope to make
|
21
|
-
|
22
20
|
development in rubymotion more enjoyable by tacking "UI" methods onto the
|
23
|
-
|
24
21
|
base classes (String, Fixnum, Float). With sugarcube, you can create a
|
25
|
-
|
26
22
|
color from an integer or symbol, or create a UIFont or UIImage from a
|
27
|
-
|
28
23
|
string.
|
29
24
|
|
30
|
-
|
31
25
|
Some UI classes are opened up as well, like adding the <tt><<</tt> operator to a
|
32
|
-
|
33
26
|
<tt>UIView</tt> instance, instead of <tt>view.addSubview(subview)</tt>, you can
|
34
|
-
|
35
27
|
use the more idiomatic: <tt>view << subview</tt>.
|
36
|
-
|
37
|
-
'
|
38
28
|
email:
|
39
29
|
- colinta@gmail.com
|
40
30
|
executables: []
|
@@ -94,6 +84,7 @@ files:
|
|
94
84
|
- lib/sugarcube-factories/uibarbuttonitem.rb
|
95
85
|
- lib/sugarcube-factories/uibutton.rb
|
96
86
|
- lib/sugarcube-factories/uisegmentedcontrol.rb
|
87
|
+
- lib/sugarcube-factories/uitabbaritem.rb
|
97
88
|
- lib/sugarcube-factories/uitableview.rb
|
98
89
|
- lib/sugarcube-factories/uitableviewcell.rb
|
99
90
|
- lib/sugarcube-files.rb
|
@@ -247,6 +238,7 @@ files:
|
|
247
238
|
- spec/uicontrol_spec.rb
|
248
239
|
- spec/uiimage_spec.rb
|
249
240
|
- spec/uilabel_spec.rb
|
241
|
+
- spec/uitabbaritem_spec.rb
|
250
242
|
- spec/uitableviewcell_spec.rb
|
251
243
|
- spec/uiview_animation_spec.rb
|
252
244
|
- spec/uiview_attr_updates_spec.rb
|
@@ -258,27 +250,26 @@ files:
|
|
258
250
|
homepage: https://github.com/rubymotion/sugarcube
|
259
251
|
licenses:
|
260
252
|
- BSD
|
253
|
+
metadata: {}
|
261
254
|
post_install_message:
|
262
255
|
rdoc_options: []
|
263
256
|
require_paths:
|
264
257
|
- lib
|
265
258
|
required_ruby_version: !ruby/object:Gem::Requirement
|
266
|
-
none: false
|
267
259
|
requirements:
|
268
|
-
- -
|
260
|
+
- - '>='
|
269
261
|
- !ruby/object:Gem::Version
|
270
262
|
version: '0'
|
271
263
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
272
|
-
none: false
|
273
264
|
requirements:
|
274
|
-
- -
|
265
|
+
- - '>='
|
275
266
|
- !ruby/object:Gem::Version
|
276
267
|
version: '0'
|
277
268
|
requirements: []
|
278
269
|
rubyforge_project:
|
279
|
-
rubygems_version:
|
270
|
+
rubygems_version: 2.0.3
|
280
271
|
signing_key:
|
281
|
-
specification_version:
|
272
|
+
specification_version: 4
|
282
273
|
summary: Extensions for Ruby to make Rubymotion development more enjoyable, and hopefully
|
283
274
|
more rubyesque!
|
284
275
|
test_files:
|
@@ -325,6 +316,7 @@ test_files:
|
|
325
316
|
- spec/uicontrol_spec.rb
|
326
317
|
- spec/uiimage_spec.rb
|
327
318
|
- spec/uilabel_spec.rb
|
319
|
+
- spec/uitabbaritem_spec.rb
|
328
320
|
- spec/uitableviewcell_spec.rb
|
329
321
|
- spec/uiview_animation_spec.rb
|
330
322
|
- spec/uiview_attr_updates_spec.rb
|