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

TextFiled修改placeholder的颜色和字体大小

2016-07-27 15:33 344 查看
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];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  uitextfield nsstring