开发者

UILongPressGestureRecognizer issue

i have one issue regarding UILongPressGestureRecognizer, i have add gesture like below of the c开发者_Python百科ode

**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];

}

So we Long press on button two times call alertview, does anyone have a idea, why facing this issue.


So you press the button (then release it I guess) and you are getting the message two times?

Perhaps you should check the state of the GestureRecognizer (like if it's the begin phase or end phase) GestureRecognizer state.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜