最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[已解决]swift设置文本框占位符的文字颜色

Swift crifan 2108浏览 0评论

swift uitextfield placeholder color

swift – Set UITextField placeholder color programmatically – Stack Overflow

ios – Changing Placeholder Text Color with Swift – Stack Overflow

然后代码:

let ColorTextFieldPlaceholderGray:UIColor = UIColor(hexString: "#C0C0C0")!
        let attributedUserPlaceholder = NSAttributedString(string: "手机号", attributes: [NSForegroundColorAttributeName : ColorTextFieldPlaceholderGray])
        userTextField.attributedPlaceholder = attributedUserPlaceholder

效果:

转载请注明:在路上 » [已解决]swift设置文本框占位符的文字颜色

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
84 queries in 0.187 seconds, using 22.05MB memory