改变TextField输入的颜色

来源:互联网 发布:知乎 搞笑图片 编辑:程序博客网 时间:2024/06/14 06:58

 UITextField *textField=[[UITextFieldalloc] initWithFrame:CGRectMake(50,100, 200,50)];

    textField.layer.borderWidth =0.5;

    textField.layer.borderColor = [[UIColorgrayColor]CGColor];

    //UITextField设置placeholder颜色

    UIColor *color = [UIColorredColor];

    textField.attributedPlaceholder = [[NSAttributedStringalloc] initWithString:@"密码"attributes:@{NSForegroundColorAttributeName: color}];

    textField.delegate=self;

    [self.viewaddSubview:textField];

0 0