Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to dynamically set the image of a UIBarButtonItem #12

Open
Sweeper777 opened this issue Aug 25, 2016 · 2 comments
Open

Unable to dynamically set the image of a UIBarButtonItem #12

Sweeper777 opened this issue Aug 25, 2016 · 2 comments

Comments

@Sweeper777
Copy link

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?

@felixLam
Copy link
Member

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.

@felixLam
Copy link
Member

To really fix this we would need to listen to changes on the image property of the barbutton item (KVO).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants