iOS隐藏键盘方式

点击Done隐藏键盘

// action 事件选择 Did End On Exit
- (IBAction)textFieldDoneEditing:(id)sender {
    [sender resignFirstResponder];
}

点击空白处隐藏键盘

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    [self.view endEditing:YES];
}

你可能感兴趣的:(iOS隐藏键盘方式)