Reputation: 401
I've got a number of UIButtons set up in Interface Builder (but all linked with appropriate outlet names). These buttons have images set up using the inspector in Interface Builder.
I would however, like to be able to change the images shown in the buttons during a certain event (so for example the user selects an appropriate settings choice and all the buttons change from displaying an image of a frog, to an image of a rabbit).
Is there a straight forward way of doing this? The change must be immediate, not on the next load.
Many thanks
Upvotes: 2
Views: 572
Reputation: 390
Would something like, this work for you?
[button setBackgroundImage:[UIImage imageNamed:@"frog.png"] forState:UIControlStateNormal];
Upvotes: 4