对输入的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-键盘回收的更多相关文章

  1. iOS 键盘回收实现步骤

    第一步:遵守协议 (UITextFieldDelegate) @interface AppDelegate : UIResponder <UIApplicationDelegate,UIText ...

  2. iOS开发小技巧--iOS键盘 inputView 和 inputAccessoryView

    iOS键盘 inputView 和 inputAccessoryView 1.inputAccessoryView UITextFields和UITextViews有一个inputAccessoryV ...

  3. IOS - 键盘处理

    iOS 发布了很多关于屏幕上键盘的通知.下面列出了这些通知的简要解释: UIKeyboardWillShowNotification 当键盘即将要显示的时候将会发出这个通知.这个通知包含了用户信息库, ...

  4. IOS键盘弹出、隐藏

    IOS键盘 UIKeyboardFrameBeginUserInfoKey:动画开始前键盘的size UIKeyboardFrameEndUserInfoKey:动画结束后键盘的size - (voi ...

  5. ios键盘弹起 body的高度拉长,页面底部空白问题。ios软键盘将页面抵到上面后,关闭软键盘页面不回弹的问题。

    js 监听ios手机键盘弹起和收起的事件 /* js 监听ios手机键盘弹起和收起的事件 */ document.body.addEventListener('focusin', () => { ...

  6. 键盘回收(text filed,textview)

    键盘回收 #pragma mark - TextField 代理方法 - (BOOL)textFieldShouldReturn:(UITextField *)textField { [self.vi ...

  7. iOS- UITextView与键盘回收与键盘遮挡输入框

    一.UITextView 可以实现多行输入的文本框,基本属性与UITextField相似,可以输入多行,可以滚动.UITextView还有个代理方式- (BOOL)textView:(UITextVi ...

  8. iOS 键盘自适应(IQKeyboardManager)使用小结

    IQKeyboardManager Github地址 经常在开发一个应用程序,我们遇到了一个问题,iPhone的键盘上滑覆盖的UITextField / UITextView.IQKeyboardMa ...

  9. iOS键盘中英文切换键盘高度获取通知方法

    iOS键盘中英文切换键盘高度获取通知方法, 有需要的朋友可以参考下. 注册通知 - (void)viewWillAppear:(BOOL)animated { [super viewWillAppea ...

  10. iOS 键盘遮挡输入框万能解决方案(多个输入框)

    效果图如下: 思路分析: 代码: 知识点: 问题: 效果图如下: 思路分析: 当我们有很多输入框时,有时候键盘弹出来会遮挡着输入框.我们需要获取输入框和键盘相对于最外层视图的位置来判断是否遮挡,如果遮 ...

随机推荐

  1. 前端面试题总结(js、html、小程序、React、ES6、Vue、算法、全栈热门视频资源)

    写在前面 参考答案及资源在看云平台发布,如果大家想领取资源以及查看答案,可直接前去购买.一次购买永久可看,文档长期更新!有什么意见与建议欢迎您及时联系作者或留言回复! 文档描述 本文是关注微信小程序的 ...

  2. jquery添加节点时能有点击事件

    <script>            var n=0;            $(".dj").on('click',function(){              ...

  3. springboot快速开发(简单web)

    这是一个springboot基础配置文件介绍的demo.只涉及到 控制层与前端的简单交互,用于验证代码的畅通. spring-boot  pom.xml解释 <?xml version=&quo ...

  4. iOS Build Apps for the World WWDC

    Programming Resources https://developer.apple.com/internationalization/ WWDC Session Videos Internat ...

  5. ansible小计

    一.忽略hosts,只在一台机器上执行: /usr/local/bin/ansible-playbook /app/ansiblecfg/ztr/ent_extract.yml --limit=10. ...

  6. dos6章

    现在开始: 在CMD使用IF /?打开IF的系统帮助(自己看我就不全部列出来了),我们会发现IF有3种基本的用法!执行批处理程序中的条件处理. IF [NOT] ERRORLEVEL number c ...

  7. windows下postgreSQL安装与启动

    转:https://www.yiibai.com/postgresql/install-postgresql.html https://blog.csdn.net/irainreally/articl ...

  8. [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 ...

  9. EmptyBeanUtil

    package com.rscode.credits.util; import java.util.List; /** * * 判断实体是否为空 * @author tn * */ public cl ...

  10. OnApplicationFocus & OnApplicationPause &时间戳

    锁屏.切到后台 程序强制暂停时使用 private long leaveTime; private void OnApplicationFocus(bool focus) { if (focus==f ...