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

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

Swift crifan 2413浏览

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设置文本框占位符的文字颜色

80 queries in 0.387 seconds, using 19.12MB memory