Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 Swift 4 中更改 UITextfield 占位符的颜色?似乎是一项简单的任务,但由于我是新的编程和 Swift,我很难弄清楚。我想以编程方式更改颜色。
tf.placeholder = "Name" tf.translatesAutoresizingMaskIntoConstraints = false UIFont.systemFont(ofSize: 15, weight: UIFont.Weight.thin)
someTextField.attributedPlaceholder = NSAttributedString(string: "Placeholder text", attributes: [NSAttributedStringKey.foregroundColor: UIColor.red])