views:

158

answers:

0

so I have implemented a 1-finger long-press gesture recognizer, but the recognizer always seems to be missing the UIGestureRecognizerStateBegan state... If I long press w/o moving finger and lift, I get the StateEnded debug message. If I long press and move finger a bit then lift, I get the StateChanged and StateEnded debug messages. But I never see StateBegan.

Don't have this issue with UIPanGestureRecognizer - Pan gets all the correct gesture states from Began->Changed->Ended.

- (void)handleLongPress:(UILongPressGestureRecognizer *)recognizer {
    CGPoint location = [recognizer locationInView:self];

    switch (recognizer.state) {
        case UIGestureRecognizerStateBegan:
            NSLog(@"!!!!handleLongPress: StateBegan !!!!!");
            break;
        case UIGestureRecognizerStateChanged:
            NSLog(@"!!!!handleLongPress: StateChanged !!!!!");
            break;
        case UIGestureRecognizerStateEnded:
            NSLog(@"!!!!handleLongPress: StateEnded !!!!!");
            break;
        default:
            break;
    }   
}