1

Badge

I'm not able to reposition badge to the default position as it normally should be. I've tried this solution and few more but none work. How to adjust tab bar badge position?

My issue may be with Tab bar images rather than badge position. I've played a lot with tab bar image sizes, insets etc but none seem to work.

Does anyone know how to go about fixing it?

Dan
  • 475
  • 9
  • 26

1 Answers1

4
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.

Pramod Shukla
  • 235
  • 2
  • 10