您的位置:首页 > 产品设计 > UI/UE

//改变UITextfield的Placeholder字体的颜色

2016-03-08 11:47 417 查看
- (void)viewDidLoad {

[super viewDidLoad];

[self changeUITextfieldColor];

}

//改变UITextfield的Placeholder字体的颜色

- (void)changeUITextfieldColor{

UITextField * textField = [[UITextField alloc]init];

//方法1

// UIColor *color = [UIColor blackColor];

// textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"用户名" attributes:@{NSForegroundColorAttributeName: color}];

//方法2

textField.placeholder = @"用户名";

[textField setValue:[UIColor blueColor] forKeyPath:@"_placeholderLabel.textColor"];

textField.frame = CGRectMake(10, 100, 200, 50);

[self.view addSubview:textField];

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: