美文网首页
IOS开发技巧(一)--收起键盘

IOS开发技巧(一)--收起键盘

作者: 奋斗的DevAmos | 来源:发表于2017-03-31 15:06 被阅读47次

// 开发技巧

//    在UIViewController中收起键盘,除了调用相应控件的resignFirstResponder方法外,还有另外三个方法:

//    1.重载UIViewController中的touchsBegin方法,然后在里面执行[self.view endEditing:YES];  这样单击UIViewController的任意地方,就可以收起键盘

//    2.直接执行[[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];用于获取当前UIViewController比较困难的时候用

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

相关文章

网友评论

      本文标题:IOS开发技巧(一)--收起键盘

      本文链接:https://www.haomeiwen.com/subject/fhrvottx.html