iOS 键盘回收

1、Return按扭收起键盘

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

2、调用resignFirstResponder

[self.textF resignFirstResponder]

3、任何地方加上这句代码,统一收起键盘

[[[UIApplication sharedApplication] keyWindow] endEditing:YES];

或者这句统一回收键盘

[[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];

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