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

修改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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  color uitextfield 字体