在處理長按手勢時,警告框一直彈出兩次,解決方法如下:
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");
}
}