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

How must be used directly form storyboard? #7

Closed
Ricardo1980 opened this issue Mar 21, 2014 · 3 comments
Closed

How must be used directly form storyboard? #7

Ricardo1980 opened this issue Mar 21, 2014 · 3 comments

Comments

@Ricardo1980
Copy link

If I add a barButtonItem in the navigation bar and change its custom class to BBBadgeBarButtonItem and in my code write:
BBBadgeBarButtonItem* chatBarButtonItem=(BBBadgeBarButtonItem*)self.navigationItem.rightBarButtonItem;
chatBarButtonItem.badgeValue=@"1";
It does not work.
Any help?

@TanguyAladenise
Copy link
Owner

Something I haven't quit figured out yet.
It seems there is problem in the view hierarchy.
If you set in the storyboard the BarButtonItem to custom the barButtonItem.customView property stays nill therefore the badge being added as a subview of barButtonItem.customView is not possible. If I force it, the image you set up in the storyboard is overided by the custom view, therefore not appearing while the badge does.
I need to find a way to retrieve the custom view you set up in the storyboard and manually add it as the customView property of the BarButtonItem so the badge can work with it. But I did not get the time and chance to focus on that.

For the moment I can only suggest you do it programmatically. Hope this helps to understand the behaviour.

@Ricardo1980
Copy link
Author

Thanks for feedback. I will try programatically.

Enviado desde mi iPhone.

El 21/03/2014, a las 11:06, Tanguy Aladenise notifications@github.com escribió:

Something I haven't quit figured out yet.
It seems there is problem in the view hierarchy.
If you set in the storyboard the BarButtonItem to custom the barButtonItem.customView property stays nill therefore the badge being added as a subview of barButtonItem.customView is not possible. If I force it, the image you set up in the storyboard is overided by the custom view, therefore not appearing while the badge does.
I need to find a way to retrieve the custom view you set up in the storyboard and manually add it as the customView property of the BarButtonItem so the badge can work with it. But I did not get the time and chance to focus on that.

For the moment I can only suggest you do it programmatically. Hope this helps to understand the behaviour.


Reply to this email directly or view it on GitHub.

@erf
Copy link

erf commented Mar 6, 2016

I looked into this now and it seem i am not able to retrieve UIBarButtonItem._view of type UINavigationButton, which could be used instead of the customView, for adding the badge, if used from the storyboard directly.

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

No branches or pull requests

3 participants