TextView键盘输入 弹出指定高度 点击return收回虚拟键盘
2014-07-01 17:14
435 查看
textField代理相关操作方法
//点击背景关键盘 - (IBAction)BackGround:(id)sender { [[[UIApplication sharedApplication] keyWindow] endEditing:YES]; } #pragma mark textfield delegate - (BOOL)textFieldShouldReturn:(UITextField *)textField { [[[UIApplication sharedApplication] keyWindow] endEditing:YES]; return YES; } //textField 弹到指定高度 - (void)textFieldDidBeginEditing:(UITextField *)textField { CGRect frame = textField.frame; int offset = frame.origin.y + 32 - (self.view.frame.size.height - 216.0)+frame.size.height +88;//键盘高度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]; } - (void)textFieldDidEndEditing:(UITextField *)textField { 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 resignFirstResponder]; }
相关文章推荐
- 1怎样让输入的text文本填写的部分只添加数字、2怎样将输入的数字一次性全部删除 3怎样选择密码 让它不显示 4 怎样实现在没有return的情况下点击button的情况下就能够使键盘页面下落5 怎样实现点击指定的button来对使指定的text进行键盘弹出 6怎样改变button按钮的状态
- Android是一个针对触摸屏专门设计的操作系统,当点击编辑框,系统自动为用户弹出软键盘,以便用户进行输入。 那么,弹出软键盘后必然会造成原有布局高度的减少,那么系统应该如何来处理布局的减少
- 阻止jquery datepicker控件在移动设备上被点击时弹出输入键盘
- iOS 上常用的两个功能:点击屏幕和return退出隐藏键盘和解决虚拟键盘挡住UITextField的方法
- Android获取虚拟键盘的高度 和判断键盘弹起和收回的状态,
- iOS输入视图(如UITextView UITextField)点击时没有弹出键盘输入窗
- 点击输入框弹出输入键盘,点击输入框外侧隐藏输入键盘
- iOS 上常用的两个功能:点击屏幕和return退出隐藏键盘和解决虚拟键盘挡住UITextField的方法
- 键盘右下角的return按钮的点击事件 & 点击屏幕收回键盘
- iOS 常用:点击屏幕和return退出隐藏键盘和解决虚拟键盘挡住UITextField的方法
- IOS点击UITextField不弹出键盘但是可以输入粘贴。。。
- 点击键盘的return键收回键盘
- iOS 上常用的两个功能:点击屏幕和return退出隐藏键盘和解决虚拟键盘挡住UITextField的方法
- 安卓点击Edittext弹出对话框实现操作(DatePicker,实现日期的输入)隐藏键盘
- iOS 上常用的两个功能:点击屏幕和return退出隐藏键盘和解决虚拟键盘挡住UITextField的方法
- iOS 上常用的两个功能:点击屏幕和return退出隐藏键盘和解决虚拟键盘挡住UITextField的方法
- web网页input框设置,点击input框弹出键盘,再收回键盘,焦点框会随页面滚动
- iOS 上常用的两个功能:点击屏幕和return退出隐藏键盘和解决虚拟键盘挡住UITextField的方法
- TextView随键盘弹出上移高度
- IOS上点击屏幕和return退出隐藏键盘和解决虚拟键盘挡住UITextField的方法