UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc]
initWithTarget:self
action:@selector(handleLongPress:)];
longPress.minimumPressDuration = 1.0;
[myView addGestureRecognizer:longPress];
[longPress release];
- (void)handleLongPress:(UILongPressGestureRecognizer *)sender {
if(UIGestureRecognizerStateBegan == sender.state) {
// Do initial work here
}
if(UIGestureRecognizerStateChanged == sender.state) {
// Do repeated work here (repeats continuously) while finger is down
}
if(UIGestureRecognizerStateEnded == sender.state) {
// Do end work here when finger is lifted
}
}