3
在UIBarButtonItem上提供徽章的剂量ios? 如果没有那么如何以编程方式做到这一点,或使用任何库(什么是最好的图书馆) 如何将徽章添加到UINavigationItem(UIBarButtonItem) - Swift 3
在图像我想告诉喜欢红色的圆形或数字的任何事情上的UIBarButtonItem徽章(刷新按钮图标)。
在UIBarButtonItem上提供徽章的剂量ios? 如果没有那么如何以编程方式做到这一点,或使用任何库(什么是最好的图书馆) 如何将徽章添加到UINavigationItem(UIBarButtonItem) - Swift 3
在图像我想告诉喜欢红色的圆形或数字的任何事情上的UIBarButtonItem徽章(刷新按钮图标)。
我使用MIBadgeButton其工作就像一个魅力。
var appNotificationBarButton: MIBadgeButton! // Make it global
self.appNotificationBarButton = MIBadgeButton(frame: CGRect(x: 0, y: 0, width: 50, height: 40))
self.appNotificationBarButton.setImage(UIImage(named: "bell"), for: .normal)
self.appNotificationBarButton.badgeEdgeInsets = UIEdgeInsetsMake(10, 0, 0, 10)
self.appNotificationBarButton.addTarget(self, action: #selector(self.appNotificationClicked), for: .touchUpInside)
let App_NotificationBarButton : UIBarButtonItem = UIBarButtonItem(customView: self.appNotificationBarButton)
self.navigationItems.rightBarButtonItem = App_NotificationBarButton
@rkkanojai我不认为ios在UIBarButtonItem上提供了徽章号码。您需要添加一个标签来显示徽章数量。 – Developer