module BubbleWrap::UIViewWrapper
Public Class Methods
deprecated_methods()
click to toggle source
# File motion/ui/ui_view_wrapper.rb, line 31 def self.deprecated_methods %w(whenTapped whenPinched whenRotated whenSwiped whenPanned whenPressed) end
Public Instance Methods
when_panned(enableInteraction=true, &proc)
click to toggle source
# File motion/ui/ui_view_wrapper.rb, line 19 def when_panned(enableInteraction=true, &proc) add_gesture_recognizer_helper(UIPanGestureRecognizer.alloc.initWithTarget(self, action:'handle_gesture:'), enableInteraction, proc) end
when_pinched(enableInteraction=true, &proc)
click to toggle source
# File motion/ui/ui_view_wrapper.rb, line 7 def when_pinched(enableInteraction=true, &proc) add_gesture_recognizer_helper(UIPinchGestureRecognizer.alloc.initWithTarget(self, action:'handle_gesture:'), enableInteraction, proc) end
when_pressed(enableInteraction=true, &proc)
click to toggle source
# File motion/ui/ui_view_wrapper.rb, line 27 def when_pressed(enableInteraction=true, &proc) add_gesture_recognizer_helper(UILongPressGestureRecognizer.alloc.initWithTarget(self, action:'handle_gesture:'), enableInteraction, proc) end
when_rotated(enableInteraction=true, &proc)
click to toggle source
# File motion/ui/ui_view_wrapper.rb, line 11 def when_rotated(enableInteraction=true, &proc) add_gesture_recognizer_helper(UIRotationGestureRecognizer.alloc.initWithTarget(self, action:'handle_gesture:'), enableInteraction, proc) end
when_screen_edge_panned(enableInteraction=true, &proc)
click to toggle source
# File motion/ui/ui_view_wrapper.rb, line 23 def when_screen_edge_panned(enableInteraction=true, &proc) add_gesture_recognizer_helper(UIScreenEdgePanGestureRecognizer.alloc.initWithTarget(self, action:'handle_gesture:'), enableInteraction, proc) end
when_swiped(enableInteraction=true, &proc)
click to toggle source
# File motion/ui/ui_view_wrapper.rb, line 15 def when_swiped(enableInteraction=true, &proc) add_gesture_recognizer_helper(UISwipeGestureRecognizer.alloc.initWithTarget(self, action:'handle_gesture:'), enableInteraction, proc) end
when_tapped(enableInteraction=true, &proc)
click to toggle source
# File motion/ui/ui_view_wrapper.rb, line 3 def when_tapped(enableInteraction=true, &proc) add_gesture_recognizer_helper(UITapGestureRecognizer.alloc.initWithTarget(self, action:'handle_gesture:'), enableInteraction, proc) end
Private Instance Methods
add_gesture_recognizer_helper(recognizer, enableInteraction, proc)
click to toggle source
Adds the recognizer and keeps a strong reference to the Proc object.
# File motion/ui/ui_view_wrapper.rb, line 49 def add_gesture_recognizer_helper(recognizer, enableInteraction, proc) setUserInteractionEnabled true if enableInteraction && !isUserInteractionEnabled self.addGestureRecognizer(recognizer) @recognizers = {} unless @recognizers proc.weak! if !proc.nil? && BubbleWrap.use_weak_callbacks? @recognizers[recognizer] = proc recognizer end
handle_gesture(recognizer)
click to toggle source
# File motion/ui/ui_view_wrapper.rb, line 44 def handle_gesture(recognizer) @recognizers[recognizer].call(recognizer) end