UIGestureRecognizerDelegate Protocol Reference
| Conforms to | |
| Framework | /System/Library/Frameworks/UIKit.framework |
| Availability | Available in iOS 3.2 and later. |
| Companion guide | |
| Declared in | UIGestureRecognizer.h |
Overview
Delegates of a gesture recognizer—that is, an instance of a concrete subclass of UIGestureRecognizer—adopt the UIGestureRecognizerDelegate protocol to fine-tune an application’s gesture-recognition behavior. They receive messages from the gesture recognizer, and their responses to these messages enable them to affect the operation of the gesture recognizer or permit the simultaneous operation of two gesture recognizers.
Instance Methods
gestureRecognizer:shouldReceiveTouch:
Ask the delegate if a gesture recognizer should receive an object representing a touch.
Parameters
- gestureRecognizer
An instance of a subclass of the abstract base class
UIGestureRecognizer.- touch
A
UITouchobject from the current multi-touch sequence.
Return Value
YES (the default) to allow the gesture recognizer to examine the touch object, NO to prevent the gesture recognizer from seeing this touch object.
Discussion
This method is called before touchesBegan:withEvent: is called on the gesture recognizer for a new touch.
Availability
- Available in iOS 3.2 and later.
See Also
Declared In
UIGestureRecognizer.hgestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:
Asks the delegate if two gesture recognizers should be allowed to recognize gestures simultaneously.
Parameters
- gestureRecognizer
An instance of a subclass of the abstract base class
UIGestureRecognizer. This is the object sending the message to the delegate.- otherGestureRecognizer
An instance of a subclass of the abstract base class
UIGestureRecognizer.
Return Value
YES to allow both gestureRecognizer and otherGestureRecognizer to recognize their gestures simultaneously. The default implementation returns NO—no two gestures can be recognized simultaneously.
Discussion
This method is called when recognition of a gesture by either gestureRecognizer or otherGestureRecognizer would block the other gesture recognizer from recognizing its gesture. Note that returning YES is guaranteed to allow simultaneous recognition; returning NO, on the other hand, is not guaranteed to prevent simultaneous recognition because the other gesture recognizer's delegate may return YES.
Availability
- Available in iOS 3.2 and later.
Declared In
UIGestureRecognizer.hgestureRecognizerShouldBegin:
Asks the delegate if a gesture recognizer should begin interpreting touches.
Parameters
- gestureRecognizer
An instance of a subclass of the abstract base class
UIGestureRecognizer. This gesture-recognizer object is about to begin processing touches to determine if its gesture is occurring.
Return Value
YES (the default) to tell the gesture recognizer to proceed with interpreting touches, NO to prevent it from attempting to recognize its gesture.
Discussion
This method is called when a gesture recognizer attempts to transition out of the UIGestureRecognizerStatePossible state. Returning NO causes the gesture recognizer to transition to the UIGestureRecognizerStateFailed state.
Availability
- Available in iOS 3.2 and later.
Declared In
UIGestureRecognizer.h© 2010 Apple Inc. All Rights Reserved. (Last updated: 2010-09-15)