您好,欢迎来到要发发知识网。
搜索
您的当前位置:首页IOS 长按手势触发两次事件

IOS 长按手势触发两次事件

来源:要发发知识网

在处理长按手势时,警告框一直弹出两次,解决方法如下:

UILongPressGestureRecognizer*longPressGesture = [[UILongPressGestureRecognizeralloc]initWithTarget:selfaction:@selector(DeleatLogout:)];

[selfaddGestureRecognizer:longPressGesture];

- (void) DeleatLogout:(UILongPressGestureRecognizer*)longPress {

if(longPress.state==UIGestureRecognizerStateBegan) {

NSString*str = [NSStringstringWithFormat:@"您是否确定要删除%@的所有信息?",_card.binType];

UIAlertView*alertView = [[UIAlertViewalloc]initWithTitle:@"删除卡"message:strdelegate:selfcancelButtonTitle:@"取消"otherButtonTitles:@"确认",nil];

[[UIViewappearance]setTintColor:[UIColorcolorWithRed:177/255.0green:215/255.0blue:116/255.0alpha:1]];

[alertViewshow];

}else{

NSLog(@"long pressTap state :end");

}

}

Copyright © 2019- net188.cn 版权所有 湘ICP备2022005869号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务