zoukankan      html  css  js  c++  java
  • UITextField 属性

    - (void)viewDidLoad

    {

        [super viewDidLoad];

        UITextField *input=[[UITextField alloc] initWithFrame:CGRectMake(0, 100, 200, 100)];

        self.textfield=input;

        [input setText:@"hahah"];

        input.textAlignment=NSTextAlignmentCenter;

        input.contentVerticalAlignment=UIControlContentVerticalAlignmentCenter;

        input.contentHorizontalAlignment=UIControlContentHorizontalAlignmentCenter;

        

        input.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];

        input.textColor=[UIColor blueColor];

        input.keyboardAppearance=UIKeyboardAppearanceLight;

    //    input.alpha=0;

        

        input.tintColor=[[UIColor redColor] colorWithAlphaComponent:0.5];

        

        [self.view addSubview:input];

        

    }

       UITextField * myTextField = [[UITextField alloc] initWithFrame:CGRectMake(50, 100, 200, 50)];

        myTextField.backgroundColor = [UIColor clearColor];
        //简单设置textField的边缘样式
        myTextField.borderStyle = UITextBorderStyleRoundedRect;
        //占位显示的内容(水印)
        myTextField.placeholder = @"请输入姓名";
        //对齐模式
        myTextField.textAlignment = NSTextAlignmentLeft;
        //显示清除按钮的模式
        myTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
    //    设置背景图
    //    myTextField.disabledBackground
    //    每次输入字符变成点.常用于密码输入
    //    myTextField.secureTextEntry = YES;
        //再次编辑就清空
    //    text.clearsOnBeginEditing = YES;
        //设置键盘的样式
    //    text.keyboardType = UIKeyboardTypeNumberPad;
        //首字母是否大写
    //    text.autocapitalizationType = UITextAutocapitalizationTypeNone;
        //return键变成什么键
    //    text.returnKeyType =UIReturnKeyDone;
        //键盘外观
    //    textView.keyboardAppearance=UIKeyboardAppearanceDefault;
        //按return键键盘往下收
    //    becomeFirstResponder
         
         
         
         
    //    UIView* view1 = [[UIView alloc]initWithFrame:CGRectMake(0,0,40,0)];
    //    UIImageView * imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"music.png"]];
    //    imageView.frame = CGRectMake(0,0,40,40);
    //    UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
    //    imageView.image = [UIImage imageNamed:@"music.png"];
         
         
         
         
         
         
        //左视图,视图可以是UIView下的任意视图.
    //    myTextField.leftView = imageView;
        //左视图的显示模式
    //    myTextField.leftViewMode = UITextFieldViewModeAlways;
        //右视图
    //    myTextField.rightView
        //右视图显示模式
    //    myTextField.rightViewMode
  • 相关阅读:
    datalist和repeater中radiobutton单选的问题
    SQL循环在表中增加新列
    [jQuery]使用jQuery.Validate进行客户端验证(高级篇上)——不使用微软验证控件的理由
    C# Excel 行高,列宽,合并单元格,单元格边框线,冻结 关于C#操作EXCLE常见操作比较全的
    JS弹出窗口的运用与技巧(转)
    设计模式完整备忘录
    jquery + ashx + Json 操作数据
    SQL STUFF函数 拼接字符串
    获取SQL 各字段说明,表名等有效信息
    谈谈对于企业级系统架构的理解
  • 原文地址:https://www.cnblogs.com/zhibin/p/4115984.html
Copyright © 2011-2022 走看看