Class: UIEvent

Inherits:
Object show all
Defined in:
lib/ios/sugarcube-to_s/uievent.rb

Instance Method Summary collapse

Instance Method Details

#to_sObject



3
4
5
6
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
33
34
35
36
37
38
# File 'lib/ios/sugarcube-to_s/uievent.rb', line 3

def to_s
  type = case self.type
          when UIEventTypeTouches
            'touch'
          when UIEventTypeMotion
            if self.subtype == UIEventSubtypeMotionShake
              'shake'
            else
              'motion'
            end
          when UIEventTypeRemoteControl
            case self.subtype
            when UIEventSubtypeRemoteControlPlay
              'remote-control, Play'
            when UIEventSubtypeRemoteControlPause
              'remote-control, Pause'
            when UIEventSubtypeRemoteControlStop
              'remote-control, Stop'
            when UIEventSubtypeRemoteControlTogglePlayPause
              'remote-control, TogglePlayPause'
            when UIEventSubtypeRemoteControlNextTrack
              'remote-control, NextTrack'
            when UIEventSubtypeRemoteControlPreviousTrack
              'remote-control, PreviousTrack'
            when UIEventSubtypeRemoteControlBeginSeekingBackward
              'remote-control, BeginSeekingBackward'
            when UIEventSubtypeRemoteControlEndSeekingBackward
              'remote-control, EndSeekingBackward'
            when UIEventSubtypeRemoteControlBeginSeekingForward
              'remote-control, BeginSeekingForward'
            when UIEventSubtypeRemoteControlEndSeekingForward
              'remote-control, EndSeekingForward'
            end
          end
  "#{self.class.to_s}(#{type}, touches: #{allTouches.inspect})"
end