iOS动态获取键盘高度
2016-03-03 11:04
531 查看
注册通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) name:UIKeyboardDidShowNotification object:nil];
通知对应方法
- (void)keyboardWasShown:(NSNotification *)notification{ // Get the size of the keyboard. CGSize keyboardSize = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size; //Given size may not account for screen rotation int height = MIN(keyboardSize.height,keyboardSize.width); int width = MAX(keyboardSize.height,keyboardSize.width); //your other code here.......... }
相关文章推荐
- 如何设计一个 iOS 控件?(iOS 控件完全解析)
- iOS9 class dump header
- iOS9 class dump header
- iOS开发-清理缓存功能的实现
- iOS开发中常用第三方库的整理
- sencha touch 2以上版本不兼容最新ios9组件的思路
- iOS 动画
- 开发完iOS应用,接下去你该做的事
- CollectionView嵌套TableView。页面滑动指向不同的标题
- iOS does not contain bitcode 报错解决
- iOS 导出Private API
- iOS系统自带毛玻璃效果
- iOS开发中对于一些常用的相对路径(持续更新)
- iOS数组和字典的使用----大坑
- iOS设备中WiFi、蓝牙和飞行模式的开启与关闭
- iOS-动画进阶之路Core Animation
- iOS 字符转换
- iOS滑动返回问题
- iOS Please verify that your device’s clock is properly set, and that your signing certificate is not
- iOS 集成银联支付