作者:liuc | 来源:互联网 | 2023-09-23 19:31
UILongPressGestureRecognizer*longPressGR[[UILongPressGestureRecognizeralloc]initWithTarget
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];
}
iOS按钮长按,,
iOS按钮长按