Reputation: 450
I have a Swift Mac OS X project with a NSTextField where I display multiple lines of text. I can change the color of all the text in the text field
searchResult_field.stringValue = result
searchResult_field.textColor = NSColor.redColor()
But I'd like to be able have some lines the default color and others a different color.
Upvotes: 1
Views: 182
Reputation: 2343
You can use NSAttributedString
to color each range of the string in a different color.
Upvotes: 1