Class: MotionBindable::Strategies::UILabel
Instance Attribute Summary
#attr_name, #bound, #object
Instance Method Summary
collapse
#observe_object, #stop_observe_object
#bind, #bound_value, find_by_reference, #initialize, #object_value, register_strategy
Instance Method Details
#observeValueForKeyPath(_, ofObject: _, change: _, context: _) ⇒ Object
14
15
16
|
# File 'lib/strategies/ui_label.rb', line 14
def observeValueForKeyPath(_, ofObject: _, change: _, context: _)
on_object_change
end
|
#on_object_change(new = nil) ⇒ Object
9
10
11
12
|
# File 'lib/strategies/ui_label.rb', line 9
def on_object_change(new = nil)
@bound.text = (new || attribute)
@bound.setNeedsDisplay
end
|
#start_observing_object ⇒ Object
5
6
7
|
# File 'lib/strategies/ui_label.rb', line 5
def start_observing_object
observe_object { |_, new| on_object_change(new) }
end
|
#unbind ⇒ Object
18
19
20
21
|
# File 'lib/strategies/ui_label.rb', line 18
def unbind
stop_observe_object
super
end
|