I have subclassed UIToolbar and within it have created a set of UIButtonItems, all added in order and nicely spaced with flexible spaces. I now want to toggle one of the UIButtonItems each time it is tapped (just like the shuffle button in iPod, white blue white blue. I have maintained a reference to the UIButtonItem
// interface UIButtonItem *_shuffleButton; // released in dealloc
// implementation UIImage *_shuffleButtonImage = [UIImage imageNamed:@"shuffle_icon_200x100.png"]; _shuffleButton = [[UIBarButtonItem alloc] initWithImage:_shuffleButtonImage style:UIBarButtonItemStylePlain target:self action:@selector(shuffleButtonTapped)];
So now in shuffleButtonTapped I want to do something like _shuffleButton.highlighted = YES; or _shuffleButton.selected = YES;
but neither of these work.
I have searched high and low and after failing to find anything I am starting to think I am missing something, can anyone tell me what it might be?? Thanks.