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

UITextField 的Placeholder的字体的颜色大小

2016-05-16 13:57 381 查看
设置UITextField的placeholder的颜色代码片段:

UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
NSString *holderText = @"标哥的技术博客";
NSMutableAttributedString *placeholder = [[NSMutableAttributedString alloc] initWithString:holderText];
[placeholder addAttribute:NSForegroundColorAttributeName
value:[UIColor redColor]
range:NSMakeRange(0, holderText.length)];
[placeholder addAttribute:NSFontAttributeName
value:[UIFont boldSystemFontOfSize:16]
range:NSMakeRange(0, holderText.length)];
textField.attributedPlaceholder = placeholder;
[cell.contentView addSubview:textField];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: