Instance Property

attributedPlaceholder

The styled string that is displayed when there is no other text in the text field.

Declaration

@NSCopying var attributedPlaceholder: NSAttributedString? { get set }

Discussion

This property is nil by default. If set, the placeholder string is drawn using system-defined color and the remaining style information (except the text color) of the attributed string. Assigning a new value to this property also replaces the value of the placeholder property with the same string data, albeit without any formatting information. Assigning a new value to this property does not affect any other style-related properties of the text field.

See Also

Accessing the Text Attributes

var text: String?

The text displayed by the text field.

var attributedText: NSAttributedString?

The styled text displayed by the text field.

var placeholder: String?

The string that is displayed when there is no other text in the text field.

var defaultTextAttributes: [NSAttributedString.Key : Any]

The default attributes to apply to the text.

var font: UIFont?

The font of the text.

var textColor: UIColor?

The color of the text.

var textAlignment: NSTextAlignment

The technique to use for aligning the text.

var typingAttributes: [NSAttributedString.Key : Any]?

The attributes to apply to new text being entered by the user.

enum UITextField.BorderStyle

The type of border drawn around the text field.