zoukankan      html  css  js  c++  java
  • 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;  // 确认
  • 相关阅读:
    蓝桥杯入门训练
    <泛> STL
    传递 hdu 5961 拓扑排序有无环~
    Alice and Bob hdu 4268
    Bipartite Graph hdu 5313 bitset 并查集 二分图
    Bomb HDU 3555 dp状态转移
    不要62 hdu 2089 dfs记忆化搜索
    Leaving Auction CF 749D
    Moo University
    算法(三)
  • 原文地址:https://www.cnblogs.com/sjxjjx/p/6003847.html
Copyright © 2011-2022 走看看