第三方键盘高度
来源:互联网 发布:java svn使用教程 编辑:程序博客网 时间:2024/05/07 17:45
//第三方键盘,监听UIKeyboardWillShowNotification时,会触发三次,如果在这个监听事件中拿键盘的高度,第一次拿到的是0,第二次是系统键盘高度,第三次是真正的高度//例://添加监听- (void)addObserverEvent { self.keyboardHeight = 216; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil]; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardWillHiden) name:UIKeyboardWillHideNotification object:nil];}//键盘即将出现- (void)keyboardWillShow:(NSNotification *)notifition { NSDictionary *userInfo = notifition.userInfo; self.keyboardHeight = [[userInfo objectForKey:@"UIKeyboardBoundsUserInfoKey"] CGRectValue].size.height; objc_setAssociatedObject(self.class, &kIsGetKeyBoardHeight, [NSNumber numberWithFloat:self.keyboardHeight], OBJC_ASSOCIATION_RETAIN_NONATOMIC);//将得到的高度绑定到类上,程序退出之前都可以不监听了}//键盘已经出现。。。处理第三方键盘在要跟随键盘的view做动画效果之前还没有拿到真正的高度- (void)keyboardDidShow:(NSNotification *)notifition { NSDictionary *userInfo = notifition.userInfo; self.keyboardHeight = [[userInfo objectForKey:@"UIKeyboardBoundsUserInfoKey"] CGRectValue].size.height; objc_setAssociatedObject(self.class, &kIsGetKeyBoardHeight, [NSNumber numberWithFloat:self.keyboardHeight], OBJC_ASSOCIATION_RETAIN_NONATOMIC); [self showAnimation];}//键盘消失,移除监听- (void)keyboardWillHiden { [[NSNotificationCenter defaultCenter]removeObserver:self name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidShowNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];}//第三方键盘有键盘消失按钮!!!键盘消失之后,再点击界面键盘重新出现- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { if (![_passWord isFirstResponder]) [_passWord becomeFirstResponder];}
0 0
- 第三方键盘高度
- 第三方键盘高度
- iOS第三方键盘高度获取方法
- iOS监测第三方键盘高度
- 监控键盘高度(包括第三方键盘)
- 解决第三方键盘的高度带来的问题。
- 监听第三方键盘
- 禁用第三方键盘
- iOS8以后第三方键盘,获取高度为0的问题
- IOS8禁用第三方键盘
- IOS8禁用第三方键盘
- iOS 禁用第三方键盘
- iOS 禁用第三方键盘
- 自动获取cell高度的第三方
- iOS 第三方库全局键盘处理
- 好用的键盘第三方
- 关于IOS中禁用第三方键盘
- IQKeyboardManager 自动处理键盘回收第三方
- 水电费说的
- C# winfrom 长时间检查不到操作,自动关闭应用程序
- ionic 在线聊天项目模板
- centos6.5(阿里云)安装jdk,tomcat
- LevelDB学习笔记
- 第三方键盘高度
- windows批处理命令大全
- VB作业
- HDU:最短路(单源最短路径Dijistra)
- Ext.grid.CheckboxSelectionModel去除全选框
- 欢迎使用CSDN-markdown编辑器
- hibernate
- 如何解决ajax跨域问题
- 使用Genymotion时出现INSTALL_FAILED_CPU_ABI_INCOMPATIBLE错误