Changing Placeholder Text Color with Swift

前端 未结 30 2532
独厮守ぢ
独厮守ぢ 2020-11-29 15:57

I have a design that implements a dark blue UITextField, as the placeholder text is by default a dark grey colour I can barely make out what the place holder te

30条回答
  •  孤独总比滥情好
    2020-11-29 16:10

    For Swift 4.0, X-code 9.1 version or iOS 11 you can use following syntax to have different placeholder color

    textField.attributedPlaceholder = NSAttributedString(string: "Placeholder Text", attributes: [NSAttributedStringKey.foregroundColor : UIColor.white])
    

提交回复
热议问题