在處理長(zhǎng)按手勢(shì)時(shí),警告框一直彈出兩次,解決方法如下:
UILongPressGestureRecognizer*longPressGesture = [[UILongPressGestureRecognizeralloc]initWithTarget:selfaction:@selector(DeleatLogout:)];
[selfaddGestureRecognizer:longPressGesture];
- (void) DeleatLogout:(UILongPressGestureRecognizer*)longPress {
if(longPress.state==UIGestureRecognizerStateBegan) {
NSString*str = [NSStringstringWithFormat:@"您是否確定要?jiǎng)h除%@的所有信息?",_card.binType];
UIAlertView*alertView = [[UIAlertViewalloc]initWithTitle:@"刪除卡"message:strdelegate:selfcancelButtonTitle:@"取消"otherButtonTitles:@"確認(rèn)",nil];
[[UIViewappearance]setTintColor:[UIColorcolorWithRed:177/255.0green:215/255.0blue:116/255.0alpha:1]];
[alertViewshow];
}else{
NSLog(@"long pressTap state :end");
}
}