zoukankan      html  css  js  c++  java
  • iOS 当键盘覆盖textFiled时简单的处理方法

    //方法1---

    - (void)textFieldDidBeginEditing:(UITextField *)textField {

        

        if (iPhone5) {

            return;

        }

        else

        {

            [UIView beginAnimations:nil context:NULL];

            [UIView setAnimationDuration:0.3];

            [UIView setAnimationDelegate:self];

            

            //设定动画开始时的状态为目前画面上的样子

            [UIView setAnimationBeginsFromCurrentState:YES];

            

            self.view.frame = CGRectMake(self.view.frame.origin.x,

                                         self.view.frame.origin.y - 70,

                                         self.view.frame.size.width,

                                         self.view.frame.size.height);

            

            [UIView commitAnimations];

        }

    }

    //方法2---scrollView

    -(void)textViewDidBeginEditing:(UITextView *)textView

    {

        if (iPhone5)

        {

            //改变当前的滚动位置

            [self.myScroll setContentOffset:CGPointMake(0,phoneNumberTextFiled.frame.origin.y-190) animated:YES];

        }

        else

        {

            //改变当前的滚动位置

            [self.myScroll setContentOffset:CGPointMake(0,phoneNumberTextFiled.frame.origin.y-100) animated:YES];

        }

    }

  • 相关阅读:
    opatch卸载weblogic12.1.3.0补丁
    linux weblogic12.1.3.0卸载过程
    pip install xxxx报错(一大堆红色exception)【解决】
    (CVE-2017-10271)weblogic12.1.3.0漏洞测试与打补丁过程
    linux 安装weblogic12.1.3.0步骤
    python基础实战之猜年龄游戏
    python基础小结
    计算机基础
    面向对象基础
    数据库总结
  • 原文地址:https://www.cnblogs.com/Ewenblog/p/3884572.html
Copyright © 2011-2022 走看看