Motion Events
In Chapter 5, we briefly talked about UIView’s superclass, UIResponder. Instances of UIResponder can become the first responder of the window and will receive events when the device is shaken or a key is pressed on the keyboard. You will make the instance of HypnosisView the first responder of Hypnosister’s window. Shaking the device will send a message to the HypnosisView, and that method will change its circleColor.
To give a UIResponder first responder status, you send it the message becomeFirstResponder. In HypnosisterAppDelegate.m, tell the HypnosisView instance to become the first responder. The becomeFirstResponder method returns a Boolean value indicating whether the receiving object successfully became the first responder ...
Get iOS Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.