键盘的弹出与消失(通知)
来源:互联网 发布:淘宝特卖女装 编辑:程序博客网 时间:2024/05/17 03:07
**键盘的通知
:**
//UIKeyboardWillShowNotification(键盘即将显示)
//UIKeyboardDidShowNotification(键盘已经显示)
//UIKeyboardWillHideNotification(键盘即将隐藏)
//UIKeyboardDidHideNotification(键盘已经隐藏)
//UIKeyboardWillChangeFrameNotification(键盘的位置尺寸即将发生 改变)
//UIKeyboardDidChangeFrameNotification(键盘的位置尺寸已经发生 改变)
1.订阅通知键盘的位置尺寸即将发生 改变
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
2.例 键盘弹出 弹回
- (void)keyboardWillChangeFrame:(NSNotification *)noti{ CGFloat duration = [noti.userInfo[@"UIKeyboardAnimationDurationUserInfoKey"] floatValue]; CGRect frame = [noti.userInfo[@"UIKeyboardFrameEndUserInfoKey"] CGRectValue]; CGFloat offsetY = frame.origin.y - self.view.frame.size.height; [UIView animateWithDuration:duration animations:^{ self.view.transform = CGAffineTransformMakeTranslation(0, offsetY); }];}
- 最后不要忘了退订通知
- (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self];}
0 0
- 键盘的弹出与消失(通知)
- 监听键盘的弹出与消失
- 监听键盘的弹出与消失
- 开发笔记——检测键盘的弹出与消失
- [iOS]监控手机虚拟键盘弹出,消失的通知简单使用
- 键盘出现和消失,系统的通知
- iOS键盘弹出又消失的问题
- 键盘弹出和收起的通知
- (二十四)监听键盘的通知和键盘弹出隐藏的View移动
- 监听键盘弹出和消失
- Android通知与消失的导航
- 如何让 UITextField弹出的键盘 消失disappear
- 键盘弹出和消失View的上下移动效果
- 软键盘弹出与消失的方法
- iOS获取键盘的高度(在键盘出现,改变和消失时通知改变)
- 弹出输入法键盘,标题栏上移消失问题解决
- 键盘消失的操作方法
- 通知-键盘通知和模仿QQ拖拽弹出键盘
- python_netcat
- noip2006-金明2008.11.5
- sum=sum+a;关于此的初级解读
- oracle 11g表空间使用率统计心得
- shell编程入门
- 键盘的弹出与消失(通知)
- epoll详细工作原理
- 使用python创建数据库表空间
- machine-learning第七周 上机作业
- freemarker assign 声明变量,boolean,date,date日期格式转换
- JSP的结构和生命周期
- python机器学习包mlxtend的安装和配置
- 数组中只出现一次的数字
- PAT1002.写出这个数