回收键盘

UITextField回收键盘
1.通过代理方法回收键盘

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return YES;
}

2.点击空白区域回收键盘

// 收回键盘
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    [self endEditing:YES];
}

你可能感兴趣的:(回收键盘)