iOS按钮长按

UILongPressGestureRecognizer *longPressGR = 

                [[UILongPressGestureRecognizer alloc] initWithTarget:self 

                                                              action:@selector(handleLongPress:)];

                longPressGR.allowableMovement=NO;

                longPressGR.minimumPressDuration = 0.2;

                [btn addGestureRecognizer:longPressGR];

                [longPressGR release];

 //响应的事件

-(IBAction)handleLongPress:(id)sender{

    

        UIButton *button=(UIButton*)[(UILongPressGestureRecognizer *)sender view];

        NSInteger ttag=[button tag];

}

原文地址:https://www.cnblogs.com/XCoderLiu/p/3897640.html