UITextField *textField = [[UITextField alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];
NSString *holderText = @"holderText";
//color
[placeholder addAttribute:NSForegroundColorAttributeName
value:[UIColor redColor]
range:NSMakeRange(0, holderText.length)];
//font
[placeholder addAttribute:NSFontAttributeName
value:[UIFont boldSystemFontOfSize:16]
textField.attributedPlaceholder = placeholder;
[self.view addSubview:textField];
ios textfield 改变 placeholder 颜色
UITextField自定义占位符样式
最新推荐文章于 2019-12-31 16:48:19 发布
本文介绍如何使用Swift在UITextField中自定义占位符的字体颜色及样式,包括设置字体大小和颜色。
200

被折叠的 条评论
为什么被折叠?



