​​ ​

The AppleCare Support Community will permanently close on November 20, 2026. Starting today, the site will no longer accept new posts and is available in a read-only state.


You can continue to find trusted guidance and support on the official Apple Support site. 


We want to thank the community members who have contributed their time and expertise to help others with their Apple products.


is there any way to set text color of a (NS)Button in IB?

as the title reads.. is there? i'm using xcode 4.6

xcode-OTHER, OS X Mountain Lion (10.8.2)

Posted on Mar 7, 2013 6:30 PM

4 replies

Mar 8, 2013 8:34 AM in response to swesluggo

If you are asking about the actual text color then yes it is possible but not so simple.


If you look at the class definition for NSButton youwill see two methods


  • – setAttributedAlternateTitle:
  • – setAttributedTitle:


These will allow you to specify an attributed string as the button label and in the attributed string you can set the string attributes such as color.


If you are just looking to change the background color or somehtingalong those lines that can be done right in NSButton.

Mar 10, 2013 12:41 AM in response to Frank Caggiano

Hi Frank and thank you for your response!

I know how to do it programmatically but i was wondering if it is possible in Interface Builder..? Seeing as it is just an attributedString i would imagine it should be.. I've tried setting the color of it in the font editor of the button, the cell and then, thinking i had finally found it, of the actual string (by first selecting the cell, then double-clicking the title, right-clicking the directly editable text and selecting Font > Show colors) but without results. Right now i've subclassed NSButton and implemented some setTitleColorWith... functions but it feels a bit silly to have to set up the default UI-look programmatically when you have IB!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

is there any way to set text color of a (NS)Button in IB?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.