原文来自于http://www.cnblogs.com/GarveyCalvin/p/4167759.html
1、第一种是最常见的resignFirstResponder
1 | [textField resignFirstResponder]; |
2、第二种,点击view结束
1 | [self.view endEditing:YES]; |
3、利用window统一收起键盘(同第二种)
1 | [[[UIApplication sharedApplication] keyWindow] endEditing:YES]; |
4、源自:《iOS开发进阶》 —— 唐巧,直接发送resignFirstResponder
1 | [[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil]; |