UILabel: highlightedTextColor property
The highlightedTextColor property is the text color when the label is in the highlighted state.
Value
A color string, or null.
- Readable and writable.
- The default is
null, meaning the color does not change when highlighted. - Accepts a color string or a
UIColorobject on write. The string read back is the same as the one written. - Only takes effect when
isHighlightedistrue.
Invalid values
Writing an invalid color does not throw. The console prints a warning and the color keeps its previous value:
[Nacre] highlightedTextColor: "#GGG" is not a valid color, ignoredExamples
js
const label = new UILabel();
label.highlightedTextColor = 'systemYellow';
console.log(label.highlightedTextColor);Result: The console prints systemYellow.
Corresponding iOS API
UILabel.highlightedTextColor. In ObjC it is a UIColor object; here it is written as a string.