开发者

UITouch for UItableview?

开发者 https://www.devze.com 2023-04-05 03:17 出处:网络
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 coor

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号