• UI基础之UITextField相关


    UITextField *textF = [[UITextField alloc] init];

    1、字体相关

        textF.text = @"文本框文字";
        textF.textColor = [UIColor blueColor];  // 字体颜色
        textF.textAlignment = NSTextAlignmentCenter;    // 文字对齐方式
        textF.font = [UIFont systemFontOfSize:13.0];    // 设置字体大小
        textF.font = [UIFont boldSystemFontOfSize:13.0];    // 设置加粗字体大小
        textF.font = [UIFont fontWithName:@"Arial" size:13.0];  // 设置字体样式及大小

    2、边框

        textF.borderStyle = UITextBorderStyleRoundedRect;   // 边框样式

    3、背景相关

        textF.backgroundColor = [UIColor whiteColor];   // 背景颜色
        textF.background = [UIImage imageNamed:@"a"];
        textF.disabledBackground = [UIImage imageNamed:@"b"];

    4、清除按钮

        textF.clearButtonMode = UITextFieldViewModeWhileEditing;    // 当编辑时显示

    5、占位文字

        textF.placeholder = @"占位文字";

    6、光标相关

        textF.tintColor = [UIColor redColor];

    7、文本安全性

        textF.secureTextEntry = YES;    // 文本安全性(用于密码显示)

    8、清空文本框

        textF.clearsOnBeginEditing = YES;   // 再次编辑清空

    9、键盘

        textF.keyboardType = UIKeyboardTypeNumberPad;   // 数字键盘

    10、回车键样式

        textF.returnKeyType = UIReturnKeyDone;  // 确认
  • 相关阅读:
    ubuntu16.04安装ibus中文输入法
    apt --fix-broken install
    fuelgauge
    make flash FLASH_CONFIG=jtag_full
    使用android ndk编译boost动态库
    RK3288的gpio设置
    RK3288 GPIO 输出问题
    HDU-2586-裸LCA入门-tarjan离线
    uva-11324-SCC+dp
    HDU-2767-tarjan/Kosaraju求scc
  • 原文地址:https://www.cnblogs.com/sjxjjx/p/6003847.html
Copyright © 2020-2023  润新知