Class: MotionWiretap::WiretapView

Inherits:
WiretapKvo show all
Defined in:
lib/motion-wiretap/ios/wiretap_ios.rb,
lib/motion-wiretap/osx/wiretap_osx.rb

Direct Known Subclasses

WiretapControl

Instance Attribute Summary

Attributes inherited from WiretapKvo

#property, #value

Attributes inherited from WiretapTarget

#target

Instance Method Summary collapse

Methods inherited from WiretapKvo

#bind_to, #initialize, #observeValueForKeyPath, #teardown, #trigger_changed

Methods inherited from WiretapTarget

#initialize

Methods inherited from Wiretap

#and_then, #cancel!, #combine, #dealloc, #enqueue, #filter, #initialize, #listen, #map, #on_error, #queue, #reduce, #teardown, #trigger_changed, #trigger_changed_on, #trigger_completed, #trigger_completed_on, #trigger_error, #trigger_error_on

Constructor Details

This class inherits a constructor from MotionWiretap::WiretapKvo

Instance Method Details

#handle_gestureObject



34
35
36
# File 'lib/motion-wiretap/ios/wiretap_ios.rb', line 34

def handle_gesture
  trigger_changed
end

#on(recognizer, options = nil, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/motion-wiretap/ios/wiretap_ios.rb', line 7

def on(recognizer, options=nil, &block)
  if recognizer
    case recognizer
    when :tap
      recognizer = Gestures.tap(self, options)
    when :pinch
      recognizer = Gestures.pinch(self, options)
    when :rotate
      recognizer = Gestures.rotate(self, options)
    when :swipe
      recognizer = Gestures.swipe(self, options)
    when :pan
      recognizer = Gestures.pan(self, options)
    when :press
      recognizer = Gestures.press(self, options)
    else
      raise GestureNotFound.new(recognizer.to_s)
    end

    self.target.addGestureRecognizer(recognizer)
  end

  listen(&block)

  return self
end