Class: MotionBindable::Strategies::UILabel
Constant Summary
MotionBindable::Strategy::WATCH_TICK
Instance Attribute Summary
#attr_name, #bound, #object
Instance Method Summary
collapse
#bind, find_by_reference, #initialize, register_strategy
Instance Method Details
#observeValueForKeyPath(_, ofObject: _, change: _, context: _) ⇒ Object
20
21
22
|
# File 'lib/strategies/ui_label.rb', line 20
def observeValueForKeyPath(_, ofObject: _, change: _, context: _)
on_object_change
end
|
#on_object_change(new = nil) ⇒ Object
15
16
17
18
|
# File 'lib/strategies/ui_label.rb', line 15
def on_object_change(new = nil)
@bound.text = (new || attribute)
@bound.setNeedsDisplay
end
|
#start_observing_object ⇒ Object
5
6
7
8
9
10
11
12
13
|
# File 'lib/strategies/ui_label.rb', line 5
def start_observing_object
object.addObserver(
self,
forKeyPath: attr_name,
options: NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld,
context: nil
)
end
|
#unbind ⇒ Object
24
25
26
27
|
# File 'lib/strategies/ui_label.rb', line 24
def unbind
object.removeObserver(self, forKeyPath: attr_name)
super
end
|