iOS5键盘弹出view自适应
来源:互联网 发布:万硕网络 编辑:程序博客网 时间:2024/05/21 17:27
- [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
- [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
- #ifdef __IPHONE_5_0
- float version = [[[UIDevice currentDevice] systemVersion] floatValue];
- if (version >= 5.0) {
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillChangeFrameNotification object:nil];
- }
- #endif
- #pragma -
- #pragma keyboard notification
- - (void)keyboardWillShow:(NSNotification*)notification {
- NSDictionary *userInfo = [notification userInfo];
- NSValue* aValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
- CGRect keyboardRect = [aValue CGRectValue];
- NSValue *animationDurationValue = [userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
- NSTimeInterval animationDuration;
- [animationDurationValue getValue:&animationDuration];
- [UIView beginAnimations:nil context:nil];
- [UIView setAnimationDuration:animationDuration];
- ... do something ...
- [UIView commitAnimations];
- }
- - (void)keyboardWillHide:(NSNotification*)notification {
- NSDictionary *userInfo = [notification userInfo];
- NSValue* aValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
- CGRect keyboardRect = [aValue CGRectValue];
- NSValue *animationDurationValue = [userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
- NSTimeInterval animationDuration;
- [animationDurationValue getValue:&animationDuration];
- [UIView beginAnimations:nil context:nil];
- [UIView setAnimationDuration:animationDuration];
- ... do something ...
- [UIView commitAnimations];
- }
改变键盘大小时也会更新视图
- iOS5键盘弹出view自适应
- android edittext 键盘弹出屏幕自适应
- 【代码笔记】iOS-键盘自适应弹出
- Android不让弹出键盘挡住View
- android不让弹出键盘挡住View
- Android不让弹出键盘挡住View
- Android不让弹出键盘挡住View
- Android不让弹出键盘挡住View
- Android不让弹出键盘挡住View
- 5.利用 NSNotificationCenter实现键盘弹出时页面自适应
- iOS5网页视图(UIWebView)中的输入框不能弹出键盘的问题
- iOS TextField 弹出键盘时实现view整体上移下移:防止弹出键盘遮挡输入框
- IOS开发键盘上方的view随着键盘的弹出、收起、键盘输入法改变而移动
- activityGroup 多个view无法自动弹出虚拟键盘
- IOS开发之自定义系统弹出键盘上方的view
- textFile弹出键盘时候整个view上移动
- 键盘弹出和消失View的上下移动效果
- 两种自定义系统弹出键盘上方的view
- asp.net中动态使用水晶报表
- IOS之font,
- Redis持久化机制
- HIVE UDF UDAF UDTF 区别 使用
- 在入侵渗透中用过的3则VBS代码
- iOS5键盘弹出view自适应
- Android APK反编译得到Java源代码和资源文件
- 数据库结构化查询语句
- Mac系统常用快捷键及技巧
- 关于微编程(Microprogramming)的简史
- jpeglib使用指南
- MinGW编译ffmpeg的静态库
- Android之PopupWindow弹出对话框
- 处理对象的多种状态及其相互转换——状态模式(五)