修改UITextfield的Placeholder字体的颜色
2016-07-25 16:52
344 查看
暂时我知道的有2种方式
第一种
UITextField * _inviteCodeTextFiled = [[UITextField alloc]init];
_inviteCodeTextFiled.placeholder = @”请输入邀请码”; [_inviteCodeTextFiled setValue:k999999color forKeyPath:@”_placeholderLabel.textColor”];
第二种
UITextField * _inviteCodeTextFiled = [[UITextField alloc]init];
NSMutableAttributedString *placeHolder = [[NSMutableAttributedString alloc]initWithString: @”请输入邀请码”];
[placeHolder addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithHexString:@”#999999” alpha:1] range:NSMakeRange(0, placeHolder.length)];
_inviteCodeTextFiled.attributedPlaceholder = placeHolder;
第一种
UITextField * _inviteCodeTextFiled = [[UITextField alloc]init];
_inviteCodeTextFiled.placeholder = @”请输入邀请码”; [_inviteCodeTextFiled setValue:k999999color forKeyPath:@”_placeholderLabel.textColor”];
第二种
UITextField * _inviteCodeTextFiled = [[UITextField alloc]init];
NSMutableAttributedString *placeHolder = [[NSMutableAttributedString alloc]initWithString: @”请输入邀请码”];
[placeHolder addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithHexString:@”#999999” alpha:1] range:NSMakeRange(0, placeHolder.length)];
_inviteCodeTextFiled.attributedPlaceholder = placeHolder;
相关文章推荐
- flash 系统字体显示问题
- C#及WPF获取本机所有字体和颜色的方法
- 谈谈网页设计中的字体应用Font Set
- PDF里的文字显示模糊的解决方法
- 保证可下载的漂亮动作2008奥运比赛项目字体
- C#实现字体旋转的方法
- 网页设计中的 serif 和 sans-serif字体应用
- 优化WordPress的Google字体以加速国内服务器上的运行
- C#实现缩放字体的方法
- ExtJs默认的字体大小改变的几种方法(自己整理)
- 一个实现字体大中小方法的JavaScript代码
- jquery实现实时改变网页字体大小、字体背景色和颜色的方法
- Color Cop V5.4.3_适合网页设计师/多用途的颜色采取器_汉化绿色版 下载
- php修改NetBeans默认字体的大小
- CSS的color颜色使用说明
- 如何解决修改StaticText的字体
- asp.net调用系统设置字体文本框的方法
- C#读取系统字体颜色与大小的方法
- linux BASH shell下设置字体及背景颜色
- 在shell或者perl中改变字体或背景的颜色