zoukankan      html  css  js  c++  java
  • UITextField 详解

     1 UITextField *tf = [[UITextField alloc] initWithFrame:CGRectMake(20, 20, 280, 30)];
     2     tf.borderStyle = UITextBorderStyleNone; // 无边框线
     3     // UITextBorderStyleBezel(边框+阴影) ,UITextBorderStyleLine(边框线) ,UITextBorderStyleRoundedRect(圆角+阴影) 按钮样式
     4     tf.text = @"xxxxx";                 // 内容
     5     tf.placeholder = @"请输入姓名";       // 站位字符
     6     [tf becomeFirstResponder];          // 成为第一响应者,显示键盘
     7     [tf resignFirstResponder];          // 失去第一响应者,隐藏键盘
     8     
     9     tf.backgroundColor = [UIColor redColor];    // 背景色
    10     tf.textColor = [UIColor greenColor];        // 字体颜色
    11     tf.background = [UIImage imageNamed:@"background.png"]; // 设置背景图
    12     
    13     tf.clearButtonMode = UITextFieldViewModeNever;  //  没有清空按钮
    14     tf.clearButtonMode = UITextFieldViewModeAlways; //  始终存在清空按钮
    15     tf.clearButtonMode = UITextFieldViewModeWhileEditing;   // 在编辑时有清空按钮
    16     tf.clearButtonMode = UITextFieldViewModeUnlessEditing;  // 编辑时没有清空按钮,其他时候都存在
    17     
    18     tf.clearsOnBeginEditing = YES;  //当编辑时,自动清空内容
    19     
    20     UIImageView *vv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"left.png"]];
    21     tf.leftView = vv;   // 设置左侧图片
    22     tf.rightView = vv;  // 设置右侧图片
    23     tf.rightViewMode = tf.leftViewMode = UITextFieldViewModeAlways; //左右图片始终存在
    24     
    25     // UITextFieldDelegage UITextField监控代理
  • 相关阅读:
    了解HDD或SDD磁盘的健康状态
    修复丢失的打开方式
    Invoke-WebRequest : 请求被中止: 未能创建 SSL/TLS 安全通道。
    绕过禁止未登陆用户访问
    debug
    更新已有数据
    编码格式(乱码)
    ajax
    Http
    科学的管理和规范标准
  • 原文地址:https://www.cnblogs.com/sell/p/2891827.html
Copyright © 2011-2022 走看看