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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access