美文网首页
键盘的显示与隐藏

键盘的显示与隐藏

作者: 一笑wangx | 来源:发表于2019-01-10 14:15 被阅读3次

    //显示键盘

    • (void)showKeyBoard {
      //设置动画的名字
      [UIView beginAnimations:@"Animation" context:nil];
      //设置动画的间隔时间
      [UIView setAnimationDuration:0.20];
      //??使用当前正在运行的状态开始下一段动画
      [UIView setAnimationBeginsFromCurrentState: YES];
      //设置视图移动的位移
      self.scrollView.frame = CGRectMake(self.scrollView.x, self.scrollView.y - 300, self.scrollView.w, self.scrollView.h);
      //设置动画结束
      [UIView commitAnimations];
      }
      //隐藏键盘

    • (void)hiddeKeyBoard {
      //设置动画的名字
      [UIView beginAnimations:@"Animation" context:nil];
      //设置动画的间隔时间
      [UIView setAnimationDuration:0.20];
      //??使用当前正在运行的状态开始下一段动画
      [UIView setAnimationBeginsFromCurrentState: YES];
      //设置视图移动的位移
      self.scrollView.frame = CGRectMake(self.scrollView.x, self.scrollView.y + 300, self.scrollView.w, self.scrollView.h);

      //设置动画结束
      [UIView commitAnimations];
      }

    相关文章

      网友评论

          本文标题:键盘的显示与隐藏

          本文链接:https://www.haomeiwen.com/subject/ioharqtx.html