关于视图随键盘移动
来源:互联网 发布:三年数据对比分析 编辑:程序博客网 时间:2024/05/22 08:01
-(void) keyboardWillShow:(NSNotification *)note{
// get keyboard size and loctaion
CGRect keyboardBounds;
[[note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] getValue: &keyboardBounds];
NSNumber *duration = [note.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
NSNumber *curve = [note.userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey];
// Need to translate the bounds to account for rotation.
keyboardBounds = [self.view convertRect:keyboardBounds toView:nil];
// get a rect for the textView frame
CGRect btnFrame = self.editView.frame;
btnFrame.origin.y = self.view.bounds.size.height - (keyboardBounds.size.height + btnFrame.size.height);
// animations settings
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:[duration doubleValue]];
[UIView setAnimationCurve:[curve intValue]];
[UIView setAnimationDelegate:self];
// set views with new info
self.editView.frame = btnFrame;
// commit animations
[UIView commitAnimations];
}
- (void) keyboardWillHide:(NSNotification *)note{
NSNumber *duration = [note.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
NSNumber *curve = [note.userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey];
// get a rect for the textView frame
CGRect btnFrame = self.editView.frame;
btnFrame.origin.y = self.view.bounds.size.height + btnFrame.size.height;
// animations settings
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:[duration doubleValue]];
[UIView setAnimationCurve:[curve intValue]];
// set views with new info
self.editView.frame = btnFrame;
// commit animations
[UIView commitAnimations];
}
// get keyboard size and loctaion
CGRect keyboardBounds;
[[note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] getValue: &keyboardBounds];
NSNumber *duration = [note.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
NSNumber *curve = [note.userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey];
// Need to translate the bounds to account for rotation.
keyboardBounds = [self.view convertRect:keyboardBounds toView:nil];
// get a rect for the textView frame
CGRect btnFrame = self.editView.frame;
btnFrame.origin.y = self.view.bounds.size.height - (keyboardBounds.size.height + btnFrame.size.height);
// animations settings
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:[duration doubleValue]];
[UIView setAnimationCurve:[curve intValue]];
[UIView setAnimationDelegate:self];
// set views with new info
self.editView.frame = btnFrame;
// commit animations
[UIView commitAnimations];
}
- (void) keyboardWillHide:(NSNotification *)note{
NSNumber *duration = [note.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
NSNumber *curve = [note.userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey];
// get a rect for the textView frame
CGRect btnFrame = self.editView.frame;
btnFrame.origin.y = self.view.bounds.size.height + btnFrame.size.height;
// animations settings
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:[duration doubleValue]];
[UIView setAnimationCurve:[curve intValue]];
// set views with new info
self.editView.frame = btnFrame;
// commit animations
[UIView commitAnimations];
}
0 0
- 关于视图随键盘移动
- 键盘遮挡———视图随键盘移动
- IOS 弹出键盘 移动视图
- 底部视图跟随键盘移动(通知)
- 关于输入框随键盘移动的方法
- iOS开发监听键盘(添加键盘和隐藏键盘,改变视图中整体控件随着键盘的高度移动)
- iOS开发----键盘弹出和隐藏时移动视图,防止被键盘挡住
- Keyboard 视图随键盘升高降低
- 输入框随键盘移动的实现
- iOS实现textfield随键盘移动
- swift 输入框随键盘移动
- iOS出现键盘的同时视图向上移动的方法讲解
- 取消视图中的键盘
- 设置表情键盘视图
- 关于键盘
- 关于键盘
- 视图随键盘的弹出整体上移UIKeyboardWillChangeFrameNotification
- 键盘移动对话框
- 11.11
- 不支持动态扩展的解决方法
- Android 打开文件后向文件写数据,但数据并不能实时保存到磁盘
- spoj 1182 Sorted bit squence (数位dp)
- 深入理解Servlet转发和重定向
- 关于视图随键盘移动
- s5p4418 Android 4.4.2 驱动层 HAL层 服务层 应用层 开发流程记录(二 硬件抽象层HAL)
- OC总结
- g729源码分析-4-基音周期搜索(中)
- 添加/删除 windows下Git右键菜单
- 深度卷积神经网络CNNs的多GPU并行框架 及其在图像识别的应用
- leetcode: Factorial Trailing Zeroes
- ffmpeg复用h264、aac为ts流
- 03-Wooyoo游戏开发之1分钟搞定3D男孩