Reputation: 25
I'm making a new app, and for one of my modes i want to change the image of a custom button by pressing the button.i have this custom button setup with an image, and i want to change the image when i press the button. any tips?
Upvotes: 1
Views: 92
Reputation: 3013
In Interface Builder select your button, in Attributes inspector change State Config to "Highlighted" and now you can define highlighted image (along with some other properties).
Via code:
[yourButton setImage:[UIImage imageNamed:@"button-h.png"] forState:UIControlStateHighlighted];
Upvotes: 2