iOS 改变textfield的 placeholder的 颜色

UITextField *textField = [[UITextField alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];
NSString *holderText = @"房贷首付";
NSMutableAttributedString *placeholder = [[NSMutableAttributedString alloc]initWithString:holderText];
[placeholderaddAttribute:NSForegroundColorAttributeName
                  value:[UIColor redColor]
                  range:NSMakeRange(0, holderText.length)];
[placeholderaddAttribute:NSFontAttributeName
                  value:[UIFontboldSystemFontOfSize:16]
                  range:NSMakeRange(0, holderText.length)];
textField.attributedPlaceholder = placeholder;
[cell.contentViewaddSubview:textField];

posted on 2016-11-29 16:55  举个例子yi聪聪  阅读(89)  评论(0编辑  收藏  举报

导航