首页 > 代码库 > iOS Dev (54) 键盘弹出后收起时View随之移动
iOS Dev (54) 键盘弹出后收起时View随之移动
iOS Dev (54) 键盘弹出后收起时View随之移动
- 作者:大锐哥
- 博客:http://prevention.iteye.com
-
添加监听
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(changeContentViewPosition:)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(changeContentViewPosition:)
name:UIKeyboardWillHideNotification
object:nil];
移除监听
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];
事件处理函数
- (void) changeContentViewPosition:(NSNotification *)notification{
NSDictionary *userInfo = [notification userInfo];
NSValue *value = http://www.mamicode.com/[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];>
Reference
- http://www.cnblogs.com/programmer-blog/p/3265110.html
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。