iOS 监听键盘的弹出,收起,并且拿到键盘的高度
来源:互联网 发布:apache服务器安装包 编辑:程序博客网 时间:2024/06/05 01:55
//监听当键盘将要出现时
[[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 *)notification
{
//获取键盘的高度
NSDictionary *userInfo = [notification userInfo];
NSValue *value = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
CGRect keyboardRect = [value CGRectValue];
int height = keyboardRect.size.height;
}
//当键退出
- (void)keyboardWillHide:(NSNotification *)notification
{
//获取键盘的高度
NSDictionary *userInfo = [notification userInfo];
NSValue *value = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
CGRect keyboardRect = [value CGRectValue];
int height = keyboardRect.size.height;
}
[[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 *)notification
{
//获取键盘的高度
NSDictionary *userInfo = [notification userInfo];
NSValue *value = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
CGRect keyboardRect = [value CGRectValue];
int height = keyboardRect.size.height;
}
//当键退出
- (void)keyboardWillHide:(NSNotification *)notification
{
//获取键盘的高度
NSDictionary *userInfo = [notification userInfo];
NSValue *value = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
CGRect keyboardRect = [value CGRectValue];
int height = keyboardRect.size.height;
}
阅读全文
0 0
- iOS 监听键盘的弹出,收起,并且拿到键盘的高度
- iOS监听键盘弹出,获取键盘的高度
- iOS 监听键盘弹出的高度,避免挡住界面
- iOS 键盘的收起
- Android 监听键盘的弹出与关闭,收起
- Android监听键盘弹出收起
- iOS获取键盘弹出高度,监听键盘弹出退出
- IOS开发键盘上方的view随着键盘的弹出、收起、键盘输入法改变而移动
- iOS 监听键盘的高度 - NSNotificationCenter
- iOS开发 - 键盘的收起
- iOS 键盘显示或消失的监听,获取键盘高度
- iOS中改变键盘的高度 监听键盘
- iOS 键盘弹出时获取键盘的高度
- 键盘弹出监听和点击键盘完键盘收起
- 键盘弹出和收起的通知
- ios键盘高度监听
- android 监听键盘弹出收起状态
- iOS监听键盘弹出
- 为何学这么多技术,却做不好Coder!
- Spring集成Quartz
- CALL STACK TRACE GENERATION
- STL中的for_each()函数
- 修复 Linux 下 sogou 输入法突然奔溃无法使用
- iOS 监听键盘的弹出,收起,并且拿到键盘的高度
- java设计模式总结
- Spring jdbcTemplate 获取insert后主键自增的表的主键id
- Python学习笔记【六】——《python基础教程》:: 抽象
- 面向对象设计的 10 条戒律
- 出现XML 文档结构必须从头至尾包含在同一个实体内的报错
- JdbcTemplate query查询方法
- 斐波那契数列-Java
- React常用css爬坑