views:

63

answers:

1

Hello,

i have one issue regarding UILongPressGestureRecognizer, i have add gesture like below of the code

**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.

A: 

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.

krzyspmac