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];

        }

    }

  • 相关阅读:
    [HNOI 2009] 有趣的数列
    [HAOI2015] 树上染色
    [BZOJ 2654] tree
    【图论 搜索】bzoj1064: [Noi2008]假面舞会
    【倍增】7.11fusion
    【二分 贪心】bzoj3477: [Usaco2014 Mar]Sabotage
    【计数】7.11跳棋
    概述「贪心“反悔”策略」模型
    复习计划里的低级错误
    【模拟】bzoj1686: [Usaco2005 Open]Waves 波纹
  • 原文地址:https://www.cnblogs.com/Ewenblog/p/3884572.html
Copyright © 2011-2022 走看看