UISwipeGestureRecognizer Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/UIKit.framework |
| Availability | Available in iOS 3.2 and later. |
| Companion guide | |
| Declared in | UISwipeGestureRecognizer.h |
Overview
UISwipeGestureRecognizer is a concrete subclass of UIGestureRecognizer that looks for swiping gestures in one or more directions. A swipe is a discrete gesture, and thus the associated action message is sent only once per gesture.
UISwipeGestureRecognizer recognizes a swipe when the specified number of touches (numberOfTouchesRequired) have moved mostly in an allowable direction (direction) far enough to be considered a swipe. Swipes can be slow or fast. A slow swipe requires high directional precision but a small distance; a fast swipe requires low directional precision but a large distance.
You may determine the location where a swipe began by calling the UIGestureRecognizer methods locationInView: and locationOfTouch:inView:. The former method gives you the centroid if more than one touch was involved in the gesture; the latter gives the location of a particular touch.
Properties
direction
The permitted direction of the swipe for this gesture recognizer.
Discussion
The default direction is UISwipeGestureRecognizerDirectionRight. See descriptions of UISwipeGestureRecognizerDirection constants for more information.
Availability
- Available in iOS 3.2 and later.
Declared In
UISwipeGestureRecognizer.hnumberOfTouchesRequired
The number of touches that must be present for the swipe gesture to be recognized.
Discussion
The default value is 1.
Availability
- Available in iOS 3.2 and later.
Declared In
UISwipeGestureRecognizer.hConstants
UISwipeGestureRecognizerDirection
The direction of the swipe.
typedef enum {
UISwipeGestureRecognizerDirectionRight = 1 << 0,
UISwipeGestureRecognizerDirectionLeft = 1 << 1,
UISwipeGestureRecognizerDirectionUp = 1 << 2,
UISwipeGestureRecognizerDirectionDown = 1 << 3
} UISwipeGestureRecognizerDirection;
Constants
UISwipeGestureRecognizerDirectionRightThe touch or touches swipe to the right. This direction is the default.
Available in iOS 3.2 and later.
Declared in
UISwipeGestureRecognizer.h.UISwipeGestureRecognizerDirectionLeftThe touch or touches swipe to the left.
Available in iOS 3.2 and later.
Declared in
UISwipeGestureRecognizer.h.UISwipeGestureRecognizerDirectionUpThe touch or touches swipe upward.
Available in iOS 3.2 and later.
Declared in
UISwipeGestureRecognizer.h.UISwipeGestureRecognizerDirectionDownThe touch or touches swipe downward.
Available in iOS 3.2 and later.
Declared in
UISwipeGestureRecognizer.h.
Availability
- Available in iOS 3.2 and later.
Declared In
UISwipeGestureRecognizer.h© 2010 Apple Inc. All Rights Reserved. (Last updated: 2010-11-15)