Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming
by Maurice Sharp, Erica Sadun, Rod Strougo
Preventing Recognizers from Working
The iPad occasionally shows a car detail view with no information and disables interacting with any of the buttons, fields, or the picker. It does not disable the swipes. They do work, but the behavior might be unexpected.
You can disable recognizers in two ways. The first is to set a recognizer’s enabled property to NO. Doing so requires a reference to the gesture. A second way is to set a gesture delegate and implement gestureRecognizer:shouldReceiveTouch:, as follows:
1. Open Main_iPad.storyboard and set the delegate for the swipe gestures to CarDetailViewController. You can do this by Ctrl-clicking a gesture recognizer and dragging a connection from the delegate outlet to the controller.
2. Open CarDetailViewController.m ...
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