Seb123
Seb123

Reputation: 491

Xcode Interface Builder set highlighted image for button

I'm making an cocoa application from Mac OS X, not for iphone.

I am able to set the background image of a button and uncheck bordered in the attribute inspector. However, I do not know how I set the image for when you click on it (highlighted/on click, whatever you want to call it). I want to do this because

I have found guides on google to do this with UIbutton but this isn't helpful since I'm making this for Mac.

I am using InAppStoreWindow and the button is in the Title bar. When I click on the button with the custom image, the background goes white: custom background with white button

Thank you very much!

Upvotes: 2

Views: 4106

Answers (1)

Justin Boo
Justin Boo

Reputation: 10198

You are getting white background when button is clicked because You're using incorrect type. You need to change button's type to Momentary Change. You can change it in Attributes inspector:

how to do it

Or change programatically:

[buttonOutlet setButtonType:NSMomentaryChangeButton];


And for highlighting: just add another image as alternate image in Attributes Inspector and it will be shown when button pressed.

Upvotes: 9

Related Questions