iOS获取键盘的高度
2014-07-18 16:21
423 查看
- (void)viewDidLoad { [super viewDidLoad]; //增加监听,当键盘出现或改变时收出消息 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; //增加监听,当键退出时收出消息 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; } //当键盘出现或改变时调用 - (void)keyboardWillShow:(NSNotification *)aNotification { //获取键盘的高度 NSDictionary *userInfo = [aNotification userInfo]; NSValue *aValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey]; CGRect keyboardRect = [aValue CGRectValue]; int height = keyboardRect.size.height; } //当键退出时调用 - (void)keyboardWillHide:(NSNotification *)aNotification { }
相关文章推荐
- iOS 获取软键盘高度
- iOS键盘中英文切换键盘高度获取通知方法
- iOS获取键盘的高度(在键盘出现,改变和消失时通知改变)
- ios开发 动态获取中英文键盘高度
- IOS 获取键盘的高度
- iOS获取键盘的高度
- IOS下获取当前用户设备中的键盘的高度
- ios --- 动态获取键盘高度
- iOS第三方键盘高度获取方法
- iOS第三方键盘高度获取不准确问题
- iOS获取键盘的高度
- iOS获取键盘高度
- iOS如何获取系统键盘的高度
- ios --- 动态获取键盘高度
- ios --- 动态获取键盘高度
- ios 获取键盘高度
- ios开发 监听键盘frame变化事件获取键盘高度( ios8&ios7 横竖屏旋转时需要注意的问题)
- iOS成长之路-获取系统键盘的高度
- iOS获取键盘高度的方法
- IOS 开发如何获取键盘高度