• 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
  • 相关阅读:
    JNI在C 和 C++ 函数实现的不同
    JNI输出log信息
    Android.mk相关知识
    Android项目编译和使用C语言动态库(so库)
    Jmeter之JDBC请求(四)
    Jmeter之Badboy录制脚本及简化脚本http请求(三)
    Jmeter之录制脚本(二)
    Android自动化压力测试之Monkey Test 异常解读(五)
    Android自动化压力测试之Monkey Test Android常见的错误类型及黑白名单的使用方法(四)
    Android自动化压力测试之Monkey Test (三)
  • 原文地址:https://www.cnblogs.com/zhibin/p/4115984.html
Copyright © 2020-2023  润新知