How can i do to detect user touches on table view section?
I tried UITapGestureRecognizer and touchesEnded: without success.
Touch Ended example
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *Touch = [[event allTouches] anyObject];
if (CGRectContainsPoint([_Sec0 frame], [Touch locationInView:_Table])) {
NSLog(@"SECTION 0");
} else if (CGRectContainsPoint([_Sec1 frame], [Touch locationInView:_Table])) {
NSLog(@"SECTION 1");
}
UITapGestureRecognizer example
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(Tapped:)];
[_Sec0 addGestureRecognizer:tap];
[tap release];
Nothing happened.
Touch is called everywhere on the view except on the table.
Tap gesture are not called.
any idea?
EDIT: of course, there is the delegate.
thanks.
The UITableView is consuming the touches and not sending them down the responder chain.
This means that the touches will not get through to the UIView beneath and trigger your function.
I found this question that might help you…
Stop UITableView consuming touch events so sliding menu in parent view can detect horizontal swipes