收起键盘

在UIViewConreoller中收起键盘的方法:

1.调用相应控件的resignFirstResponder方法

2.重载UIViewController中的touchesBegin方法,在里面执行[self.view endEditing:YES],这样点击UIViewController的任意地方,就可以收起键盘

3.直接执行  [[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];(用在较难获取当前的UIViewController时)

4.直接执行   [[[UIApplication sharedApplication] keyWindow] endEditing:YES];

posted @ 2015-11-19 17:02  不是白兔不吃糖  阅读(101)  评论(0)    收藏  举报