Change of UITextField placeholder color

后端 未结 13 1521
别跟我提以往
别跟我提以往 2021-01-30 06:09

How to dynamically change placeholder color of the UITextField? This is always the same system color.

No option in xib editor.

相关标签:
13条回答
  • 2021-01-30 07:04

    for swift 3 ,we can use this code for change the placeholder text color for UITextfield

     let placeholderColor = UIColor.red
     mytextField.attributedPlaceholder = NSAttributedString(string: mytextField.placeholder, attributes: [NSForegroundColorAttributeName : placeholderColor])
    
    0 讨论(0)
提交回复
热议问题