S.Shahsiah S.Shahsiah - 6 months ago 52
Swift Question

How can I set a custom color and font size for the title of an NSButton?(in OS X NOT iOS)

For example consider I have a button named Button and its title is "Hello" . How can I make the title red colored with a font size of 35?
Thanks for all your answers in advance!

Answer

SOLUTION:

    button.attributedTitle = NSAttributedString(string: "Title", attributes: [ NSForegroundColorAttributeName : NSColor.redColor(),  NSFontAttributeName: UIFont(name: "Chalkduster", size: 35.0)!])
Comments