I am creating a custom UIView and adding a UITapGestureRecognizer on it. I have a handler for the tap gesture. But at the same time I want my UIView to listen to touchesBegan & touchesEnded methods. I have implemented gestureRecognizer:shouldReceiveTouch: method also but touchesBegan/touchesEnded methods does not get 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];