UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(20, 20, 200, 40)];
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];
ios修改textField的placeholder的字体颜色大小
最新推荐文章于 2022-06-08 14:25:13 发布