I'm trying to setup a different image (highlighted) when the user press the UIBarButtomItem
with this code:
self.addButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"addButton"]
style:UIBarButtonItemStylePlain
target:self
action:@selector(addAlert:)];
[self.addButton setBackgroundImage:[UIImage imageNamed:@"addButtonHigh"]
forState:UIControlStateSelected
barMetrics:UIBarMetricsDefault];
self.navigationItem.rightBarButtonItem = self.addButton;
But it is not working.
The button appears with the "addButton" image, but when it is pressed the "addButtonHigh" image doesn't appear.
Thank you in advance, Victor