ISHHoverBar
ISHHoverBar copied to clipboard
Unable to dynamically set the image of a UIBarButtonItem
I added a UIBarButtonItem to a hover bar. In the UIBarButtonItem's IBAction method, I changed the image of the UIBarButtonItem:
sender.image = UIImage(...)
But the image doesn't change when I tap on the UIBarButtonItem!
I know I can do this as a workaround:
bar.items = [sender]
But can you fix this bug?
That is definetly something that we will need to fix. The underlying reason is that we cannot use a barbutton item directly and instead create a UIButton from it. As a work-around you should simply set the items array again.
To really fix this we would need to listen to changes on the image property of the barbutton item (KVO).