Friday, September 28, 2012

Difference between UITouch and UIGestureRecognizer?


Difference between UITouch and UIGestureRecognizer?

There is interesting difference present between UITouch and UIGestureRecognizer.

UITouch
UIGestureRecognizer
An UITouch object represents the presence or movement of a finger on the device screen for a particular event(single touch or multi touch).
It is a routine that check if the fingers have performed some special gestures like Tap,Pinch,Rotation,Swipe,Pan,Longpress.
This object recognize changes in a certain order during the course of an event& also report whenever there is changes in touches.
Gesture recognizers recognize a discrete event such as a tap or a swipe but do not report changes within the gesture
Different phase of a finger touch :
UITouchPhaseBegan
UITouchPhaseMoved
UITouchPhaseStationary
UITouchPhaseEnded
UITouchPhaseCancelled
Different state of a gesture recogniser :
UIGestureRecognizerStatePossible
UIGestureRecognizerStateBegan
UIGestureRecognizerStateChanged
UIGestureRecognizerStateEnded
UIGestureRecognizerStateCancelled
UIGestureRecognizerStateFailed
UIGestureRecognizerStateRecognized
Introduced in iOS 2.0
Introduced in iOS 3.2

No comments:

Post a Comment