防止键盘挡住textFiled的解决方案
来源:互联网 发布:微游戏机 vs 网络盒子 编辑:程序博客网 时间:2024/05/21 10:03
键盘出现实现textfield的代理方法- (void)textFieldDidBeginEditing:(UITextField *)textField{ CGRect frame = textField.frame; CGPoint rootFrame = [[textField superview] convertPoint:frame.origin toView:self.view];//把控件的坐标转为相对于屏幕的坐标 int offset = rootFrame.y + 56 - (self.view.frame.size.height - 216.0);//键盘高度216 NSTimeInterval animationDuration = 0.30f; [UIView beginAnimations:@"ResizeForKeyBoard" context:nil]; [UIView setAnimationDuration:animationDuration]; float width = self.view.frame.size.width; float height = self.view.frame.size.height; if(offset > 0){ CGRect rect = CGRectMake(0.0f, -offset,width,height); self.view.frame = rect; } [UIView commitAnimations];}键盘收起- (IBAction)hideKeyboard:(id)sender { NSTimeInterval animationDuration = 0.30f; [UIView beginAnimations:@"ResizeForKeyboard" context:nil]; [UIView setAnimationDuration:animationDuration]; CGRect rect = CGRectMake(0.0f, 0.0f, self.view.frame.size.width, self.view.frame.size.height); self.view.frame = rect; [UIView commitAnimations]; //在这把textField的第一焦点去掉}
0 0
- 防止键盘挡住textFiled的解决方案
- iOS开发中防止键盘挡住UITextField解决方案
- UITextField滑动防止被键盘挡住 终极解决方案
- iOS开发中防止键盘挡住UITextField解决方案
- iOS开发中防止键盘挡住UITextField解决方案
- UITextField滑动防止被键盘挡住 终极解决方案
- ios学习--iphone 防止键盘挡住UITextField解决方案
- IOS键盘挡住UITextView的解决方案
- iOS 键盘挡住输入框的解决方案
- android虚拟键盘弹出时挡住EditText的解决方案
- android开发 防止输入键盘挡住界面
- iOS解决键盘遮挡TextFiled的问题
- Popupwindow挡住键盘的问题
- 带有导航栏的控制器上键盘挡住输入框的解决方案
- 解决iOS开发中防止键盘挡住UITextField问题
- 移动端 ios键盘挡住底部 输入框的问题完美解决方案
- 移动web页面,input获取焦点弹出系统虚拟键盘时,挡住input的解决方案
- textFiled 键盘遮挡问题
- STM32驱动OV7725摄像头颜色识别
- Vue2.0 框架配置:vue-cli + vue-router + vuex
- XSL模板
- 10分钟学习python
- jQuery实战6:优雅的弹窗效果
- 防止键盘挡住textFiled的解决方案
- Mongo+Spark
- ionicCSS06_单复选框和选择框
- Java-基础 文件操作IO 检测文件是否存在
- 2017-02-06 UML用例图
- Android【垂直滚动广告条】仿淘宝头条1号店京东—垂直滚动广告条
- 酷炫的页面效果
- 【Java并发编程】并发编程大合集
- android控件的对齐方式