I have one UIImageViewwith an attached UILongPressGestureRecognizerone that never detects a long click gesture no matter how I set up the gesture recognizer. However, if I change it to UITapGestureRecognizer, which is working fine. What could happen?
Here's how I set up my own UILongPressGestureRecognizer:
UIImageView* cellView = (UIImageView*)[view viewWithTag:5];
UILongPressGestureRecognizer* longPressGestureRec =
[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(cellLongPress:)];
longPressGestureRec.numberOfTapsRequired = 1;
longPressGestureRec.numberOfTouchesRequired = 1;
longPressGestureRec.minimumPressDuration = 0.4;
[cellView addGestureRecognizer:longPressGestureRec];
[longPressGestureRec release];
Here's what it looks like cellLongPress:
-(void)cellLongPress:(UILongPressGestureRecognizer*)recognizer
{
NSLog(@"someone long pressed me");
}
Pretty simple, right? However, until it turned out that it works. Any ideas?
source
share