Reputation: 766
gestureRecognizer:shouldReceiveTouch: method isnt being called. Have i set it up improperly?
-(id) init
{
UILongPressGestureRecognizer *touchHold = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleTouchHold:)];
touchHold.minimumPressDuration = 1.0f;
touchHold.numberOfTouchesRequired = 1;
[[CCDirector sharedDirector].openGLView addGestureRecognizer:touchHold];
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
return NO;
}
Press and hold method is still being called even though i set the bool to no.
Upvotes: 10
Views: 10702
Reputation: 995
Seems like you haven't set the delegate ?
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
Is the part of UIGestureRecognizerDelegate. So you should have set the delegate too.
touchHold.delegate = self;
Edit: You should tell your view controller to implement the UIGestureRecognizerDelegate. Something like
@interface YourViewController <UIGestureRecognizerDelegate>
Upvotes: 31