UITextField 的Placeholder的字体的颜色大小

来源:互联网 发布:端口转发 8283被禁止 编辑:程序博客网 时间:2024/06/05 19:08

设置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];
0 0
原创粉丝点击