I want to capture x position of the touch point in UITableViewController. The most simply solution described in the web is UITapGestureRecognizer: enter link description here
But in this case, didSelectRowAtIndexPath are stopped.
How tu use both of the events, or how to get (NSIndexPath *)indexPath parameter inside singleTapGestureCaptured ?
Regards
[edit] I can't answer my question. The solution is:
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:touchPoint]
I doubt the OP is still waiting for an answer, but for the benefit of future searchers:
You can grab the touch event inside the cell, act, then either discard it, or pass it up the chain:
@interface MyCell : UITableViewCell
// ...
@end
@implementation MyCell
// ...
- (void) touchesBegan: (NSSet*) touches withEvent: (UIEvent*) event
{
UITouch* touch = [[event allTouches] anyObject];
CGPoint someLocation = [touch locationInView: someView];
CGPoint otherLocation = [touch locationInView: otherView];
if ([someView pointInside: someLocation: withEvent: event])
{
// The touch was inside someView. Do some stuff,
// but don't invoke tableView:didSelectRowAtIndexPath: on the delegate.
}
else if ([otherView pointInside: otherLocation: withEvent: event])
{
// The touch was inside otherView. Do other stuff.
// Send the touch on for processing, and tableView:didSelectRowAtIndexPath: handling.
[super touchesBegan: touches withEvent: event];
}
else
{
// Send the touch on for processing, and tableView:didSelectRowAtIndexPath: handling.
[super touchesBegan: touches withEvent: event];
}
}
@end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With