在处理长按手势时,警告框一直弹出两次,解决方法如下:
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");
}
}