UITouch
A UITouch holds information about where a touch occurred.
Example:
You can handle touches in any UIView (UIImageView, ...) by writing a subclass
of UIView (UIImageView, ...) and adding one or more of the following methods:
// don't forget to call
// [yourUIViewObject setUserInteractionEnabled:YES];
// declare CGPoint touchedStartPos;
// as an instance variable
// DO NOT put these methods in your
// UIViewController class
// this method is called when the
// UIView is touched
-(void) touchesBegan:(NSSet*) touches
withEvent:(UIEvent*) event
{
touchedStartPos = [[touches anyObject]
locationInView:self];
// do whatever you want to do
}
// this method is called when
// the UIView is dragged
-(void) touchesMoved:(NSSet*) touches
withEvent:(UIEvent*) event
{
CGPoint touchedEndPos =
[[touches anyObject] locationInView:self];
// do whatever you want to do
}
// this method is called when the
// touch of the UIView has ended
-(void) touchesEnded:(NSSet*) touches
withEvent:(UIEvent*) event
{
CGPoint touchedEndPos =
[[touches anyObject] locationInView:self];
// do whatever you want to do
}