zoukankan      html  css  js  c++  java
  • UILabel 的键盘操作

     
     1.添加UITextFieldDelegate
     2.添加此方法
     
     -(void)animateTextField:(UITextField *)textField up:(BOOL)up

    {    const int movementDistance = 80;

        const float movementDuration = 0.3f;

        int movement = (up?-movementDistance:movementDistance);

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

        [UIView setAnimationBeginsFromCurrentState:YES];

        [UIView setAnimationDuration:movementDuration];

        self.view.frame = CGRectOffset(self.view.frame, 0, movement);

        [UIView commitAnimations];

    }

    3.在TextFiled的回调中使用此方法

    关于TextFiled的回调罗列

    - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField;        // return NO to disallow editing.

    - (void)textFieldDidBeginEditing:(UITextField *)textField;           // became first responder

    - (BOOL)textFieldShouldEndEditing:(UITextField *)textField;          // return YES to allow editing to stop and to resign first responder status. NO to disallow the editing session to end

    - (void)textFieldDidEndEditing:(UITextField *)textField;             // may be called if forced even if shouldEndEditing returns NO (e.g. view removed from window) or endEditing:YES called

    - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;   // return NO to not change text

    - (BOOL)textFieldShouldClear:(UITextField *)textField;               // called when clear button pressed. return NO to ignore (no notifications)

    - (BOOL)textFieldShouldReturn:(UITextField *)textField;              // called when 'return' key pressed. return NO to ignore.

  • 相关阅读:
    统计中的精度和召回率的解释
    人工智能在医疗行业中的应用
    解决Myeclipse在调试(debug)时无法显示变量值问题(转载)
    溢出的问题
    返回引用和对象遇到的坑
    vmWare上网配置(转载)
    linux内核相关的术语(转载)
    一个死锁问题
    Ethernet,token ring,FDDI,ATM,WLAN(转载)
    kmalloc与vmalloc
  • 原文地址:https://www.cnblogs.com/cillyfly/p/3573275.html
Copyright © 2011-2022 走看看