ios-键盘回收
对输入的UITextField 控件设置完代理,然后粘上两种方法,即可。
#pragma mark- 键盘收回
-(void)textFieldDidEndEditing:(UITextField *)textField{
[self.recordView.phoneTextField resignFirstResponder];
[self.recordView.passWordTextField resignFirstResponder];
NSTimeInterval animationDuration = 0.0f;
[UIView beginAnimations:@"ResizeForKeyboard" context:nil];
[UIView setAnimationDuration:animationDuration];
CGRect rect = CGRectMake(self.view.frame.origin.x, (sysio7 ? 64 : 0), self.view.frame.size.width, self.view.frame.size.height);
self.view.frame = rect;
[UIView commitAnimations];
}
#pragma mark- 键盘弹起
- (void)textFieldDidBeginEditing:(UITextField *)textField {
NSTimeInterval animationDuration = 0.0f;
[UIView beginAnimations:@"ResizeForKeyBoard" context:nil];
[UIView setAnimationDuration:animationDuration];
float offset = textField.frame.origin.y + textField.frame.size.height + self.view.frame.origin.y - (sysio7 ? 64 : 0) + 255 - self.view.frame.size.height+230;
if (offset > 0) {
CGRect rect = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y - offset, self.view.frame.size.width, self.view.frame.size.height);
self.view.frame = rect;
}
[UIView commitAnimations];
}
ios-键盘回收的更多相关文章
- iOS 键盘回收实现步骤
第一步:遵守协议 (UITextFieldDelegate) @interface AppDelegate : UIResponder <UIApplicationDelegate,UIText ...
- iOS开发小技巧--iOS键盘 inputView 和 inputAccessoryView
iOS键盘 inputView 和 inputAccessoryView 1.inputAccessoryView UITextFields和UITextViews有一个inputAccessoryV ...
- IOS - 键盘处理
iOS 发布了很多关于屏幕上键盘的通知.下面列出了这些通知的简要解释: UIKeyboardWillShowNotification 当键盘即将要显示的时候将会发出这个通知.这个通知包含了用户信息库, ...
- IOS键盘弹出、隐藏
IOS键盘 UIKeyboardFrameBeginUserInfoKey:动画开始前键盘的size UIKeyboardFrameEndUserInfoKey:动画结束后键盘的size - (voi ...
- ios键盘弹起 body的高度拉长,页面底部空白问题。ios软键盘将页面抵到上面后,关闭软键盘页面不回弹的问题。
js 监听ios手机键盘弹起和收起的事件 /* js 监听ios手机键盘弹起和收起的事件 */ document.body.addEventListener('focusin', () => { ...
- 键盘回收(text filed,textview)
键盘回收 #pragma mark - TextField 代理方法 - (BOOL)textFieldShouldReturn:(UITextField *)textField { [self.vi ...
- iOS- UITextView与键盘回收与键盘遮挡输入框
一.UITextView 可以实现多行输入的文本框,基本属性与UITextField相似,可以输入多行,可以滚动.UITextView还有个代理方式- (BOOL)textView:(UITextVi ...
- iOS 键盘自适应(IQKeyboardManager)使用小结
IQKeyboardManager Github地址 经常在开发一个应用程序,我们遇到了一个问题,iPhone的键盘上滑覆盖的UITextField / UITextView.IQKeyboardMa ...
- iOS键盘中英文切换键盘高度获取通知方法
iOS键盘中英文切换键盘高度获取通知方法, 有需要的朋友可以参考下. 注册通知 - (void)viewWillAppear:(BOOL)animated { [super viewWillAppea ...
- iOS 键盘遮挡输入框万能解决方案(多个输入框)
效果图如下: 思路分析: 代码: 知识点: 问题: 效果图如下: 思路分析: 当我们有很多输入框时,有时候键盘弹出来会遮挡着输入框.我们需要获取输入框和键盘相对于最外层视图的位置来判断是否遮挡,如果遮 ...
随机推荐
- 前端面试题总结(js、html、小程序、React、ES6、Vue、算法、全栈热门视频资源)
写在前面 参考答案及资源在看云平台发布,如果大家想领取资源以及查看答案,可直接前去购买.一次购买永久可看,文档长期更新!有什么意见与建议欢迎您及时联系作者或留言回复! 文档描述 本文是关注微信小程序的 ...
- jquery添加节点时能有点击事件
<script> var n=0; $(".dj").on('click',function(){ ...
- springboot快速开发(简单web)
这是一个springboot基础配置文件介绍的demo.只涉及到 控制层与前端的简单交互,用于验证代码的畅通. spring-boot pom.xml解释 <?xml version=&quo ...
- iOS Build Apps for the World WWDC
Programming Resources https://developer.apple.com/internationalization/ WWDC Session Videos Internat ...
- ansible小计
一.忽略hosts,只在一台机器上执行: /usr/local/bin/ansible-playbook /app/ansiblecfg/ztr/ent_extract.yml --limit=10. ...
- dos6章
现在开始: 在CMD使用IF /?打开IF的系统帮助(自己看我就不全部列出来了),我们会发现IF有3种基本的用法!执行批处理程序中的条件处理. IF [NOT] ERRORLEVEL number c ...
- windows下postgreSQL安装与启动
转:https://www.yiibai.com/postgresql/install-postgresql.html https://blog.csdn.net/irainreally/articl ...
- [LeetCode&Python] Problem 703. Kth Largest Element in a Stream
Design a class to find the kth largest element in a stream. Note that it is the kth largest element ...
- EmptyBeanUtil
package com.rscode.credits.util; import java.util.List; /** * * 判断实体是否为空 * @author tn * */ public cl ...
- OnApplicationFocus & OnApplicationPause &时间戳
锁屏.切到后台 程序强制暂停时使用 private long leaveTime; private void OnApplicationFocus(bool focus) { if (focus==f ...