天天看点

启用长按事件 UILongPressGestureRecognizer

UILongPressGestureRecognizer *longPressGR = 

        [[UILongPressGestureRecognizer alloc] initWithTarget:self 

                                                      action:@selector(handleLongPress:)];

        longPressGR.minimumPressDuration = 0.2;

        [self addGestureRecognizer:longPressGR];

        [longPressGR release];

- (void)handleLongPress:(UIGestureRecognizer *)gestureRecognizer {

    NSLog(@"LONG PRESS");

}

UILongPressGestureRecognizer  正解,要求ios3.2以上