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

        //动画的内容

  • 相关阅读:
    OpenCV中Mat,图像二维指针和CxImage类的转换
    opencv reduce()函数
    vc 6.0添加版本信息
    tesseract::TessBaseAPI api
    lnk1146 erro,solution
    LNK2001 error 解决方法
    Error LNK2038 mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease'
    APP后台架构开发实践笔记
    从0到1 快速建一个区块链
    App 后台架构
  • 原文地址:https://www.cnblogs.com/CodingMann/p/4877901.html
Copyright © 2011-2022 走看看