binsnoel binsnoel - 6 months ago 18
iOS Question

UIGestureRecognizer Determine Tap

I followed this answer on SO: http://stackoverflow.com/a/12481177/2575115

but I get an error "Expected Expression". What am I doing wrong?

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch;
{
BOOL shouldReceiveTouch = YES;

if (gestureRecognizer == tap) { //Expected Expression
shouldReceiveTouch = (touch.view == _shownImage);
}
return shouldReceiveTouch;
}

Answer

you can check the UIGestureRecognizer class

-(BOOL) gestureRecognizer: (UIGestureRecognize *) gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer: (UIGestureRecognizer *) otherGestureRecognizer {
if ([gestureRecognizer isMemberOfClass: [UITapGestureRecognizer class]]) {

shouldReceiveTouch = (touch.view == _shownImage);    

     }
}