sugarcube 0.20.18 → 0.20.19
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.
- data/Gemfile.lock +1 -1
- data/README.md +13 -7
- data/lib/sugarcube/notifications.rb +9 -0
- data/lib/sugarcube/uiview.rb +2 -0
- data/lib/sugarcube/uiwebview.rb +7 -0
- data/lib/sugarcube/version.rb +1 -1
- data/spec/notification_spec.rb +9 -0
- data/spec/uiwebview_spec.rb +11 -0
- metadata +5 -2
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1266,17 +1266,23 @@ Makes it easy to post a notification to some or all objects.
|
|
1266
1266
|
|
1267
1267
|
```ruby
|
1268
1268
|
# this one is handy, I think:
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1269
|
+
MyNotification = "my notification"
|
1270
|
+
MyNotification.post_notification # => NSNotificationCenter.defaultCenter.postNotificationName(MyNotification, object:nil)
|
1271
|
+
MyNotification.post_notification(obj) # => NSNotificationCenter.defaultCenter.postNotificationName(MyNotification, object:obj)
|
1272
|
+
MyNotification.post_notification(obj, user: 'dict') # => NSNotificationCenter.defaultCenter.postNotificationName(MyNotification, object:obj, userInfo:{user: 'dict'})
|
1273
|
+
|
1274
|
+
# you can access the userInfo dictionary directly from the notification
|
1275
|
+
def notified(notification)
|
1276
|
+
notification[:user] # => 'dict'
|
1277
|
+
end
|
1272
1278
|
|
1273
1279
|
# very similar to add or remove an observer
|
1274
|
-
|
1275
|
-
|
1280
|
+
MyNotification.add_observer(observer, :method_name)
|
1281
|
+
MyNotification.add_observer(observer, :method_name, object)
|
1276
1282
|
|
1277
1283
|
# remove the observer
|
1278
|
-
|
1279
|
-
|
1284
|
+
MyNotification.remove_observer(observer)
|
1285
|
+
MyNotification.remove_observer(observer, object)
|
1280
1286
|
```
|
1281
1287
|
|
1282
1288
|
NSTimer
|
data/lib/sugarcube/uiview.rb
CHANGED
@@ -426,6 +426,7 @@ class UIView
|
|
426
426
|
subviews.each do |subview|
|
427
427
|
CGContextSaveGState(context)
|
428
428
|
CGContextTranslateCTM(context, subview.frame.origin.x, subview.frame.origin.y)
|
429
|
+
# CGContextConcatCTM(subview.layer.affineTransform)
|
429
430
|
subview.layer.renderInContext(context)
|
430
431
|
CGContextRestoreGState(context)
|
431
432
|
end
|
@@ -433,6 +434,7 @@ class UIView
|
|
433
434
|
UIGraphicsEndImageContext()
|
434
435
|
else
|
435
436
|
UIGraphicsBeginImageContextWithOptions(bounds.size, false, scale)
|
437
|
+
# CGContextConcatCTM(layer.affineTransform)
|
436
438
|
layer.renderInContext(UIGraphicsGetCurrentContext())
|
437
439
|
image = UIGraphicsGetImageFromCurrentImageContext()
|
438
440
|
UIGraphicsEndImageContext()
|
data/lib/sugarcube/version.rb
CHANGED
data/spec/notification_spec.rb
CHANGED
@@ -17,6 +17,7 @@ class NotificationsTester
|
|
17
17
|
@notification = notification
|
18
18
|
@object = notification.object
|
19
19
|
end
|
20
|
+
|
20
21
|
end
|
21
22
|
|
22
23
|
describe "Notifications" do
|
@@ -46,6 +47,14 @@ describe "Notifications" do
|
|
46
47
|
@notification_tester_object.object.should == @object
|
47
48
|
end
|
48
49
|
|
50
|
+
it "should send userInfo" do
|
51
|
+
@notification.post_notification(@object, key: :value)
|
52
|
+
@notification_tester_object.notified?.should == true
|
53
|
+
@notification_tester_object.notification.should != nil
|
54
|
+
@notification_tester_object.object.should == @object
|
55
|
+
@notification_tester_object.notification[:key].should == :value
|
56
|
+
end
|
57
|
+
|
49
58
|
after do
|
50
59
|
@notification.remove_observer(@notification_tester)
|
51
60
|
@notification.remove_observer(@notification_tester_object, @object)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sugarcube
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.20.
|
4
|
+
version: 0.20.19
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-04-
|
16
|
+
date: 2013-04-29 00:00:00.000000000 Z
|
17
17
|
dependencies: []
|
18
18
|
description: ! '== Description
|
19
19
|
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- lib/sugarcube/uitextview.rb
|
124
124
|
- lib/sugarcube/uiview.rb
|
125
125
|
- lib/sugarcube/uiviewcontroller.rb
|
126
|
+
- lib/sugarcube/uiwebview.rb
|
126
127
|
- lib/sugarcube/uuid.rb
|
127
128
|
- lib/sugarcube/version.rb
|
128
129
|
- resources/Default-568h@2x.png
|
@@ -176,6 +177,7 @@ files:
|
|
176
177
|
- spec/uiview_attr_updates_spec.rb
|
177
178
|
- spec/uiview_spec.rb
|
178
179
|
- spec/uiviewcontroller_spec.rb
|
180
|
+
- spec/uiwebview_spec.rb
|
179
181
|
- spec/unholy_spec.rb
|
180
182
|
- sugarcube.gemspec
|
181
183
|
homepage: https://github.com/rubymotion/sugarcube
|
@@ -245,4 +247,5 @@ test_files:
|
|
245
247
|
- spec/uiview_attr_updates_spec.rb
|
246
248
|
- spec/uiview_spec.rb
|
247
249
|
- spec/uiviewcontroller_spec.rb
|
250
|
+
- spec/uiwebview_spec.rb
|
248
251
|
- spec/unholy_spec.rb
|