Changing Placeholder Text Color with Swift

前端 未结 30 2547
独厮守ぢ
独厮守ぢ 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:24

    You can accomplish this quickly, without adding a line of code, using Interface Builder.

    Select the UITextField and open the identity inspector on the right:

    Click on the plus button and add a new runtime attribute:

    placeholderLabel.textColor (Swift 4)

    _placeholderLabel.textColor (Swift 3 or less)

    Use Color as type and select the color.

    That's it.

    You wont see the result until you run your app again.

提交回复
热议问题