Touches began in UITableViewController

后端 未结 5 1916
长发绾君心
长发绾君心 2021-01-17 22:38

I am defining this method in my UITableViewController subclass:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    [super touchesBegan:to         


        
5条回答
  •  臣服心动
    2021-01-17 22:52

    If you are trying to dismiss a keyboard in a UITableViewController, a decent solution is to call resignFirstResponder in the tableView delegate's didSelectRowAtIndexPath method.

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        [myTextField resignFirstResponder];
    
        // Rest of your actual didSelectRowAtIndexPath code ...
    }
    

提交回复
热议问题