I'm using Xcode 4.2 to develop an iOS 5 app.
In Storyboard I've got a view with a UIToolbar, and 3 items in it. The last item is a UIBarButtonItem. I want to change the tintColor of this UIBarButtonItem when a user taps it, until what it does is dismissed.
I've made the UIBarButtonItem an outlet in my controller, here's the code:
@property (weak, nonatomic) IBOutlet UIBarButtonItem *upArrowButton;
...
@synthesize upArrowButton = _upArrowButton;
...and I am changing the tintColor like so:
self.upArrowButton.tintColor = [UIColor greenColor];
However when the tintColor changes, the button disappears, and a new one (with the correct new tintColor) animates on screen from the left.
Any idea what mistake I've made?
UPDATE:
I've tracked down the source of the problem, it's because the method where tintColor was changed is called inside an animateWithDuration animations block.
The source of this peculiar behaviour was because I was calling the method that changed the tintColor from within an animateWithDuration animations block. Thus causing the change in tintColor to be 'animated'.