I create a custom UIView and add a UITapGestureRecognizer to it. I have a tap gesture handler. But at the same time, I want my UIView to listen to Began's touches and touch the Ended methods. I implemented the gestureRecognizer: shouldReceiveTouch: method as well, but the Began / touchesEnded methods are not called. Any clue why?
Inside my custom UIView
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)iGestureRecognizer shouldReceiveTouch:(UITouch *)iTouch { return YES; }
Inside my view controller
MyCustomView aCustomView = [[[MyCustomView alloc] init] autorelease]; UIGestureRecognizer *myGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)]; [aCustomView addGestureRecognizer:myGestureRecognizer]; [myGestureRecognizer release];
Abhinav
source share