S.Shahsiah S.Shahsiah - 1 year ago 126
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 Source

SOLUTION:

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