if ([textField isFirstResponder]) { [textField endEditing:YES]; } return YES; } 转载于:https://my.oschina.net/zhangzhihao/blog/123529