方法一:
1, 关闭键盘
[[[UIApplication sharedApplication] keyWindow] endEditing:YES];
方法二:
2, 关闭键盘
[[self findFirstResponderBeneathView:self] resignFirstResponder];
- (UIView*)findFirstResponderBeneathView:(UIView*)view
{
// Search recursively for first responder
for ( UIView *childView in view.subviews ) {
if ( [childView respondsToSelector:@selector(isFirstResponder)] && [childView isFirstResponder] )
return childView;
UIView *result = [self findFirstResponderBeneathView:childView];
if ( result )
return result;
}
return nil;
}