views:

407

answers:

1

How would I detect a long tap (tap and hold) within a UIScrollView?

+5  A: 

In view's touchesBegan: you can call your "long tap" handle with some delay.

[touchHandler performSelector:@selector(longTap:) withObject:nil afterDelay:1.5];

Then in view's touchesEnded: you can cancel that call if not enough time has passed:

[NSObject cancelPreviousPerformRequestsWithTarget:touchHandler selector:@selector(longTap:) object:nil];
Vladimir
thanksssssssss! you saved my life! (+1)
Digital Robot