最新消息:20210917 已从crifan.com换到crifan.org

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

Swift crifan 1760浏览 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,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
94 queries in 0.193 seconds, using 23.26MB memory