I'm pretty new to MonoTouch development, but I've been using the handy ToolbarItems
property on the UIViewController
to show some toolbar buttons and now I'm looking for a way to set the BadgeValue
on some of those buttons.
It seems that the UIBarButtonItem
class is missing the BadgeValue
property you see on UITabBarItem
, so the question is - how to set the badge value for a UIBarButtonItem
in the ToolbarItems
collection ?
UIBarButtonItem item1 = new UIBarButtonItem() { Title = "test" };
//item1.BadgeValue = "3"; //this doesn't work
ToolbarItems = new UIBarButtonItem[] { item1 };
Both UIBarButtonItem
and UITabBarItem inherit from UIBarItem
. Sadly BadgeValue
is only available for UITabBarItem so you'll need to reimplement this feature yourself.
This question (and answer) should help you: How to add Badges on UIBarbutton item?
But be warned that it might now look as good as a real badge.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With