//点击空白处回收键盘
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent*)event{
[self.view endEditing:YES];
}
或者
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent*)event{
[self.textField resignFirstResponder];
}
当然第一种好一些,适配当前控制器的所有textField
//点击空白处回收键盘
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent*)event{
[self.view endEditing:YES];
}
或者
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent*)event{
[self.textField resignFirstResponder];
}
当然第一种好一些,适配当前控制器的所有textField