I want开发者_运维知识库 to calculate touch location of tableview evenif we scroll it as we do in normal UIView?
You can calculate touch on selected cell and convert it to table view coordinates. X coordinate will the same as cell, but Y = Y+indexPath.row*cell.height
.
See also UIView convertPoint
method.
If your table view doesn't have more content than the screen size (perhaps static) you can disable the scrolling of the tableView like below
self.tableView.scrollEnabled = NO;
If there is more content you can use the,
hitTest: withEvent:
technique in your UIView subclass.
The actual method is
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
return [super hitTest:point withEvent:event];
}
You should use this method in a UIView subclass.
精彩评论