Motion
events
are handled analogously to the way we handled touch events
here.
The
motionBegan:withEvent:
and
motionEnded:withEvent:
methods that class
UIView
inherits from class
UIResponder
are like the methods
touchesBegan:withEvent:
and
touchesEnded:withEvent:
.
To detect a motion event,
the
responder
must be the first responder.
Press control-command-z
in the simulator to shake the iPhone for 0 seconds.
Since this is too fast to see,
we erase the message by calling the
performSelector:withObject:afterDelay:
method of class
NSObject
.
main.m
MotionAppDelegate
View