iOS巅峰之键盘回收方法
2015-10-25 13:20
260 查看
之前我们想让键盘回收, 需要设置代理, 取消第一响应者, 如果textFeild 太多使用这个方法, 不够简洁
下面介绍下endEditing:方法,该方法为UIView中的一个方法,定义为
官方文档译文:
Causes the view (or one of its embedded text fields) to resign the first responder status.
This method looks at the current view and its subview hierarchy for the text field that is currently the first responder. If it finds one, it asks that text field to resign as first responder. If the force parameter is set
to YES, the text field is never even asked; it is forced to resign.
大意为:
注销当前view(或它下属嵌入的text fields)的first responder 状态。
该方法会在当前view以及其subview层次结构中需找当前处于first responder状态的text field。如果找到的话会注销其first responder状态,如果指定force参数为YES,则不再询问text field,而直接强制注销其first responder状态。
[self.view endEditing:YES];
键盘马上关闭
下面介绍下endEditing:方法,该方法为UIView中的一个方法,定义为
Causes the view (or one of its embedded text fields) to resign the first responder status.
This method looks at the current view and its subview hierarchy for the text field that is currently the first responder. If it finds one, it asks that text field to resign as first responder. If the force parameter is set
to YES, the text field is never even asked; it is forced to resign.
大意为:
注销当前view(或它下属嵌入的text fields)的first responder 状态。
该方法会在当前view以及其subview层次结构中需找当前处于first responder状态的text field。如果找到的话会注销其first responder状态,如果指定force参数为YES,则不再询问text field,而直接强制注销其first responder状态。
[self.view endEditing:YES];
键盘马上关闭
相关文章推荐
- IOS的属性和实例变量
- (二期)IOS调试技巧
- 在iOS7下 使用@import代替#import
- ios NSString拼接方法总结
- (iOS)手动内存管理01
- 类簇在iOS开发中的应用
- 自学 iOS 开发的一些经验
- iOS开发如何提高
- iOS开发语言
- iOS程序崩溃 NaN: [nan 40]'
- iOS开发日记36-iOS中的依赖注入
- 作IFRAME于iOS您的设备上支持滚动
- IOS中 Block简介与用法(一)
- iOS开发中常见的解析XML的类库以及简要安装方法
- iOS JSON的选项NSJSONReadingMutableLeaves
- iOS中触摸事件响应者链条
- ios返回圆形图片
- iOS多线程实现3-GCD
- iOS获取.ipa程序包
- iOS开发常用第三方开源框架介绍