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];

 

}

posted on 2014-08-07 17:09  XCoderLiu  阅读(606)  评论(0编辑  收藏  举报

导航