Reputation: 2493
Instead of push button, I want to implement a image button like app store, as you can see in the image bellow:
after I click Featured image button, the image turns blue. My question is:
I can add a image into a square button, but it doesn't like the app store button.
Upvotes: 1
Views: 1488
Reputation: 10198
Create another image - blue image and just change it using -setImage
in button's action (example at the bottom). Use Gradient Button's style (It can be changed in Attributes Inspector -> Style) then You can change button's size easily. Don't forget to choose button's type to Momentary Change (it will remove white background when pushing button). Also remove border, unchecking Attributes Inspector -> Visual -> bordered checkbox. Add alternate Image (Your blue image).
Example: (when button is clicked it will be changed to blue image)
-(IBAction)buttonAction:(id)sender {
[buttonOutlet setImage:[NSImage imageNamed:@"yourBlueImageFromResources"]];
}
Note: don't forget to IBOutlet
button to buttonOutlet.
Upvotes: 3