动态键盘高度
2015-07-25 20:11
239 查看
- (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 { }
相关文章推荐
- 杭电1016
- 黑马程序员——自学总结(四)Java IO技术之流对象
- RelativeLayout相对布局介绍及属性介绍
- Android Service与Activity之间通信的几种方式
- hdu 5296 lca+dfs应用,lca倍增法模板
- tarjan算法
- Android 仿美团网,大众点评购买框悬浮效果之修改版
- Specialized Four-Digit Numbers(进制转换)
- Opencv on Ubuntu (from Ubuntu)
- [LeetCode][JavaScript]String to Integer (atoi)
- 产品阶段
- 黑马程序员——Java反射总结
- 黑马程序员---for循环和案例
- Android 重写系统Crash处理类,保存Crash信息到SD卡 和 完美退出程序的方法
- SQL中distinct的用法
- 【图的连通性】poj2942圆桌骑士
- POJ - 3264 Balanced Lineup (RMQ问题求区间最值)
- 【线段树】【树状数组】【CF 121E】幸运数列
- 课程笔记 10:数据结构(清华) 栈
- 小白学开发(iOS)OC_self 与 类方法 和 对象方法(2015-07-25)