I\'m displaying badge on tab bar but when number increase it goes out to tab bar item like shown in image
I found Kateryna's answer to be useful in putting me on the right track, but I had to update it a little:
func repositionBadge(tab: Int){
for badgeView in self.tabBarController!.tabBar.subviews[tab].subviews {
if NSStringFromClass(badgeView.classForCoder) == "_UIBadgeView" {
badgeView.layer.transform = CATransform3DIdentity
badgeView.layer.transform = CATransform3DMakeTranslation(-17.0, 1.0, 1.0)
}
}
}
Please note the tab integer is NOT zero-indexed, so the first tab will be number 1, the 2nd number 2, etc.