Touch events on UITableView?

前端 未结 7 680
[愿得一人]
[愿得一人] 2020-12-23 10:26

I have UIViewControllerand UITableView as child in the view, what I want to do is when I touch any row I am displaying a view at bottom. I want to

7条回答
  •  既然无缘
    2020-12-23 10:33

    You should forward the touch event to the view's controller. Subclass your tableview control and then override the method:

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    {
        [super touchesBegan:touches withEvent:event];  //let the tableview handle cell selection 
        [self.nextResponder touchesBegan:touches withEvent:event]; // give the controller a chance for handling touch events 
    }
    

    then , you can do what you want in the controller's touch methods.

提交回复
热议问题