WZLBadge
WZLBadge copied to clipboard
Badge is not always showing
I have a 3 UIView controller and they are called in sequence in navigation stack. VC1->VC2->VC3
VC2 has UIBarButtonItem and it shows number of cart items in viewWillAppear() and it doesn't show when pushed from VC1, but shows when popping from VC3.
Here is code
@IBOutlet weak var cartItem: UIBarButtonItem!
override func viewWillAppear(_ animated: Bool) {
if count == 0 {
self.cartItem.clearBadge()
} else {
self.cartItem.badgeBgColor = UIColor(hex:"71c386")
self.cartItem.badgeCenterOffset = CGPoint(x:-16, y:0)
self.cartItem.badgeFont = UIFont.boldSystemFont(ofSize: 12)
self.cartItem.showBadge(with: .number, value: count, animationType: .none)
}
}
I am using Xcode 8.3.2 and testing on iOS 10.3.1 iPhone 6 plus.