我有一个关于 UILongPressGestureRecognizer 的问题,我添加了如下代码所示的手势
**ViewDidLoad**
UILongPressGestureRecognizer *_longRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(ICN_TRASH_Click:)];
NSArray *recognizerArray = [[NSArray alloc] initWithObjects:_longRecognizer, nil];
[[self.view viewWithTag:2001] setGestureRecognizers:recognizerArray];
OnClick
if ([sender isKindOfClass:[UILongPressGestureRecognizer class]])
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"Are you sure delete all message ?" delegate:self cancelButtonTitle:@"Yes" otherButtonTitles:@"No",nil];
[alert show];
[alert release];
}
所以我们长按按钮两次调用alertview,
有谁知道为什么面临这个问题。
所以你按下按钮(我猜然后松开它)并且你收到了两次消息?
也许您应该检查 GestureRecognizer 的状态(例如是开始阶段还是结束阶段)手势识别器状态.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)