zoukankan      html  css  js  c++  java
  • UITextField

     

    关于UItextField的LeftView属性

        leftView属性赋值时 如果给两个textfield 同时设置这个属性  不能是同一个 View 如果是同一个View 这个页面就不能跳转

        UIView *leftSpaceView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, leftViewW, textFieldH)];

        leftSpaceView.backgroundColor = [UIColor whiteColor];

      

        UIView *leftSpaceViewSecond = [[UIView alloc] initWithFrame:CGRectMake(0, 0, leftViewW, textFieldH)];

        leftSpaceView.backgroundColor = [UIColor whiteColor];

        UITextField *phoneNum = [[UITextField alloc] initWithFrame:CGRectMake(spaceBetweenX, 65, KScreenW - spaceBetweenX*2, textFieldH)];

        phoneNum.tag = -15;

        phoneNum.leftView = leftSpaceView;

        phoneNum.leftViewMode = UITextFieldViewModeAlways;

        phoneNum.layer.borderWidth = 1.0;

        phoneNum.layer.borderColor = [UIColor colorWithHexString:@"#dadada" withAlpha:1].CGColor;

        phoneNum.placeholder = @"已注册手机号";

        [self.view addSubview:phoneNum];

        

        

        UITextField *newCode = [[UITextField alloc] initWithFrame:CGRectMake(spaceBetweenX, CGRectGetMaxY(phoneNum.frame) + 25, KScreenW  - spaceBetweenX*2 - phoneNum.bounds.size.width*1/3 - 10, textFieldH)];

        newCode.backgroundColor = [UIColor clearColor];

        newCode.layer.borderColor = [UIColor colorWithHexString:@"#dadada" withAlpha:1].CGColor;

        newCode.layer.borderWidth = 1.0f;

        newCode.leftView = leftSpaceViewSecond;

        newCode.leftViewMode = UITextFieldViewModeAlways;

        newCode.tag = -16;

        newCode.placeholder = @"请输入短信验证码";

        [self.view addSubview:newCode];

     

     

    placeholder的字体颜色、大小

    NSAttributedString *one = [[NSAttributedString alloc] initWithString:@"    官方自带" attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:30]}];

    tureText.attributedPlaceholder = one;

    UITextField中文输入法输入时对字符长度的限制  想限制几位就写几

    - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {

        if ([textField isEqual:self.verifyField]) {

            if (range.location>=3)

                return NO;

            }

        }

      

        return YES;

    }

  • 相关阅读:
    EnrichPipeline文档
    454ITS数据按barcode和primer分类程序v1.0
    linux系统中,文件的三种特殊权限
    ITS简要分析流程(using Qiime)
    SegmentFault错误汇总
    PCoA主坐标分析
    PCA主成份分析
    软件测试工程师面试题
    我的测试团队管理之道
    如何管理好测试团队
  • 原文地址:https://www.cnblogs.com/zhaozhongpeng/p/4867820.html
Copyright © 2011-2022 走看看