Reputation: 2058
I have a UIBarButtonItem
that I originally change the background image to. But I would like to be able to change the same UIBarButtonItem
back to a default looking one (specifically a done button). Then again back to the way it was prior to (that shouldn't be a problem).
Here is how I change the appearance at first:
[menuButton setBackButtonBackgroundImage:[UIImage imageNamed:@"menuButton.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
Then back I was trying things like:
menuButton.style = UIBarButtonItemStyleDone;
menuButton.title = @"Done";
//the above didn't do anything, so I tried to make my own image to
//replace the first image. But below did't do anything either.
[menuButton setBackButtonBackgroundImage:[UIImage imageNamed:@"doneButton.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
Upvotes: 1
Views: 568
Reputation: 53551
Use setBackgroundImage:...
instead of setBackButtonBackgroundImage:...
, you're only setting the appearance of back buttons (in navigation bars).
Upvotes: 1