iOS学习-UITextField设置placeholder的颜色

UITextField *text = [[UITextField alloc] initWithFrame:CGRectMake(50, 200, 200, 40)];
text.borderStyle = UITextBorderStyleRoundedRect;
    
NSMutableAttributedString * attributedStr = [[NSMutableAttributedString alloc]initWithString:@"密码"];
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, attributedStr.length)];
text.attributedPlaceholder = attributedStr;
    
[self.view addSubview:text];

 

posted @ 2015-01-05 10:47  Zsmile  阅读(230)  评论(0编辑  收藏  举报

屛去雕饰,反近自然。