zoukankan      html  css  js  c++  java
  • 键盘弹出

    cell.Projreview.layer.cornerRadius = 5;

        cell.AnmiProjiectView.layer.cornerRadius = 5;

        cell.Headimage.layer.cornerRadius = 20;

        cell.AnmHeadimage.layer.cornerRadius = 20;

        //cell.AnmHeadimage.clipsToBounds =YES;//将超出视图范围的图片切掉

        cell.AnmHeadimage.layer.masksToBounds = YES;

        cell.Headimage.clipsToBounds = YES;

     

    键盘回弹

    //开始编辑输入框的时候,软键盘出现,执行此事件

    -(void)textFieldDidBeginEditing:(UITextField *)textField

    {

        CGRect frame=textField.frame;

        int offset =frame.origin.y+32-(self.view.frame.size.height-216.0);//键盘高度216

        NSTimeInterval animationDuration=0.30f;

        [UIView beginAnimations:@"ResizeForKeyboard" context:nil];

        [UIView setAnimationDuration:animationDuration];

        //将视图的y坐标上移offset 个单位以便弹出地方用于键盘的显示

        if (offset>0) {

            self.view.frame=CGRectMake(0.0f, -offset, self.view.frame.size.width, self.view.frame.size.height);

            [UIView commitAnimations];

        }

    }

    //engter键收回键盘

    - (BOOL)textFieldShouldReturn:(UITextField *)textField{

        [textField resignFirstResponder];

        return YES;

    }

    //输入结束, 弹回键盘

    -(void)textFieldDidEndEditing:(UITextField *)textField

    {

        self.view.frame=CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);

    }

    //点击屏幕, 收回键盘

    -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{

        [self.view endEditing:YES];

    }

     

    //添加动画效果 

    -(void)animations:(BOOL)isshow{

        [self textFieldShouldReturn:searchTF];

        //开始动画

        [UIView beginAnimations:nil context:nil];

        //设定动画持续时间

        [UIView setAnimationDuration:.5];

        //动画的内容

  • 相关阅读:
    700. Search in a Binary Search Tree
    100. Same Tree
    543. Diameter of Binary Tree
    257. Binary Tree Paths
    572. Subtree of Another Tree
    226. Invert Binary Tree
    104. Maximum Depth of Binary Tree
    1、解决sublime打开文档,出现中文乱码问题
    移植seetafaceengine-master、opencv到ARM板
    ubuntu16.04-交叉编译-SeetaFaceEngine-master
  • 原文地址:https://www.cnblogs.com/CodingMann/p/4877901.html
Copyright © 2011-2022 走看看