after tapping the ‘record’ BarButtonItem I would like to keep it programmatically highlighted until the recording is over. The highlighting graphics of iOS are very good, therefor I would like to remain or set that state.
Up to now I found ‘setSelected’ and ‘setHighlighted’ but these do not work on a UIBarButtonItem.
Any suggestions on how to solve this? Thank you in advance, Koen.
setSelectedandsetHighlightedwork fine on UIControls, but not UIBarButtonItems (which are not UIControls).I’d recommend using UIBarButtonItem’s
- (void)setBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics(documentation linked) method to change the background image to something that mimics highlighting.You can also set a custom UIView on the item which also mimics highlighting (see the
customViewproperty).