In my longpress gesture i have an problem like,
*mypressrec = [[UILongPressGestureRecognizer alloc]
initWithTarget:self
action:@selector(pressdetected:)];
mypressrec.minimumPressDuration = 3;
[self addGestureRecognizer:mypressrec];
[mypressrec release];
my function:
-(void)pressdetected:(UILongPressGestureRecognizer*)recognizer{
//My code goes here
a=90;
NSLog(@"value of my A",a);
}
here when i press for more than 3 seconds, the value of my A is printing TWICE. why it happens?
To check the state of the UILongPressGestureRecognizer just add an if statement on the selector method: