我对MonoTouch开发非常陌生,但我一直在使用UIViewController上方便的ToolbarItems属性来显示一些工具栏按钮,现在我正在寻找一种方法来设置其中一些按钮的BadgeValue。
UIBarButtonItem类似乎缺少您在UITabBarItem上看到的BadgeValue属性,所以问题是-如何为ToolbarItems集合中的UIBarButtonItem设置Badge值?
UIBarButtonItem item1 = new UIBarButtonItem() { Title = "test" };
//item1.BadgeValue = "3"; //this doesn't work
ToolbarItems = new UIBarButtonItem[] { item1 };发布于 2012-08-21 20:34:16
UIBarButtonItem和UITabBarItem都继承自UIBarItem。遗憾的是,BadgeValue只适用于UITabBarItem,所以你需要自己重新实现这个特性。
这个问题(和答案)应该会对你有所帮助:How to add Badges on UIBarbutton item?
但需要注意的是,它现在看起来可能和真正的徽章一样好。
https://stackoverflow.com/questions/12054702
复制相似问题