Graphics Programs Reference
In-Depth Information
Touch Events
As a subclass of UIResponder , your view can override four methods to handle the four
distinct touch events:
• a finger or fingers touches the screen
- (void) touchesBegan: (NSSet *)touches
withEvent: (UIEvent *)event;
• a finger or fingers move across the screen (This message is sent repeatedly as a fin-
ger moves.)
- (void) touchesMoved: (NSSet *)touches
withEvent: (UIEvent *)event;
• a finger or fingers are removed from the screen
- (void) touchesEnded: (NSSet *)touches
withEvent: (UIEvent *)event;
• a system event, like an incoming phone call, interrupts a touch before it ends
- (void) touchesCancelled: (NSSet *)touches
withEvent: (UIEvent *)event;
When a finger touches the screen, an instance of UITouch is created. The UIView that
this finger touched is sent the message touchesBegan:withEvent: and the
UITouch is in the NSSet of touches .
As that finger moves around the screen, the touch object is updated to contain the current
location of the finger on the screen. Then, the same UIView that the touch began on is
Search WWH ::




Custom Search