How can I use touchesBegan: withEvent:
method in UITableViewController class?
UITableViewController is a subclass of UIViewController class. So why the method does not works in UITableViewController?
I had a similar problem, and found a different approach that doesn't involve subclassing UITableView. Another way to do this is to add a gesture recognizer to the UITableViewController's view.
I put this code in the UITableViewController's viewDidLoad:
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
[self.view addGestureRecognizer:tap];
And implemented the event handler:
- (void)handleTap:(UITapGestureRecognizer *)recognizer
{
// your code goes here...
}
I know this solution doesnt use touchesBegan, but I found it was a simple solution to the same problem.