motion-prime/elements/base_element.rb in motion-prime-1.0.2 vs motion-prime/elements/base_element.rb in motion-prime-1.0.3
- old
+ new
@@ -64,11 +64,11 @@
view = screen.add_view class_factory(view_class), computed_options.merge(options) do |view|
@view = view
block.try(:call, view, self)
end
- if computed_options.has_key?(:delegate) && computed_options[:delegate].respond_to?(:delegated_by)
+ if computed_options.has_key?(:delegate) && computed_options[:delegate].respond_to?(:delegated_by) && view.respond_to?(:setDelegate)
computed_options[:delegate].delegated_by(view)
end
view
end
@@ -122,14 +122,14 @@
def update
update_with_options({})
end
def hide
- view.hidden = true
+ view.hidden = true if view # TODO: should we update computed options in opposite case?
end
def show
- view.hidden = false
+ view.hidden = false if view
end
def bind_gesture(action, receiver = nil)
receiver ||= self
single_tap = UITapGestureRecognizer.alloc.initWithTarget(receiver, action: action)
\ No newline at end of file