zoukankan      html  css  js  c++  java
  • iOSview整体上移下移(点击键盘)

    首先创建一个textFiled 并实现起代理方法

     1 - (void)textFieldDidBeginEditing:(UITextField *)textField
     2 {
     3     //设置动画的名字
     4     [UIView beginAnimations:@"Animation" context:nil];
     5     //设置动画的间隔时间
     6     [UIView setAnimationDuration:0.20];
     7     //??使用当前正在运行的状态开始下一段动画
     8     [UIView setAnimationBeginsFromCurrentState: YES];
     9     //设置视图移动的位移
    10     self.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y - 200, self.view.frame.size.width, self.view.frame.size.height);
    11     //设置动画结束
    12     [UIView commitAnimations];
    13 }
    14 - (void)textFieldDidEndEditing:(UITextField *)textField
    15 {
    16     //设置动画的名字
    17     [UIView beginAnimations:@"Animation" context:nil];
    18     //设置动画的间隔时间
    19     [UIView setAnimationDuration:0.20];
    20     //??使用当前正在运行的状态开始下一段动画
    21     [UIView setAnimationBeginsFromCurrentState: YES];
    22     //设置视图移动的位移
    23     self.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y +200, self.view.frame.size.width, self.view.frame.size.height);
    24     //设置动画结束
    25     [UIView commitAnimations];
    26 }
    27 - (BOOL)textFieldShouldReturn:(UITextField *)textField
    28 {
    29     [_text resignFirstResponder];
    30     return YES;
    31 }
  • 相关阅读:
    ps太卡
    vba 数字变为excel对应列的字母
    爬去网页离线数据
    vba 得到数字
    Sql Server generate table structure document
    Git
    windows凭据管理器
    修改注册表
    Software List
    1009 说反话
  • 原文地址:https://www.cnblogs.com/zhanghuanan/p/5611675.html
Copyright © 2011-2022 走看看