Ios 如何将徽章添加到UINavigationItem(UIBarButtonItem)-Swift 3
ios是否在uibarbuttonite上提供徽章? 如果不是,那么如何通过编程或使用任何库(最好的库是什么) 在图像中,我想在UIBarButtonItem(刷新按钮图标)上显示徽章,如红色圆形或数字等任何东西。我正在使用它的工作方式Ios 如何将徽章添加到UINavigationItem(UIBarButtonItem)-Swift 3,ios,iphone,swift,swift3,Ios,Iphone,Swift,Swift3,ios是否在uibarbuttonite上提供徽章? 如果不是,那么如何通过编程或使用任何库(最好的库是什么) 在图像中,我想在UIBarButtonItem(刷新按钮图标)上显示徽章,如红色圆形或数字等任何东西。我正在使用它的工作方式 var appNotificationBarButton: MIBadgeButton! // Make it global self.appNotificationBarButton = MIBadgeButton(frame: CGRect(x:
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提供了关于UIBarbuttoneim的徽章号码。您需要添加标签以显示徽章计数。