1

I change badge position with this code:

for tabBarButton in self.tabBar.subviews{
            for badgeView in tabBarButton.subviews{
                let className=NSStringFromClass(badgeView.classForCoder)
                if  className == "_UIBadgeView"
                {
                    badgeView.layer.transform = CATransform3DIdentity
                    badgeView.layer.transform = CATransform3DMakeTranslation(-5.0, 1.0, 1.0)
                }
            }
        }

As I found here

I need change it frequently. As a result, the badge jumps:

http://www.giphy.com/gifs/3og0ILQSxcXE8QucFi

Community
  • 1
  • 1
merry_ejik
  • 491
  • 6
  • 8
  • can you try badgeView.frame = CGRect.init(x: 10, y: 10, width: badgeView.frame.size.width, height: badgeView.frame.size.height) instead of transform ? – nikdange_me Mar 17 '17 at 16:47
  • @nikdange_me thanks, it sets badge frame. but after I select other tab, badge get initial frame – merry_ejik Mar 20 '17 at 10:19

1 Answers1

1

I started do this cycle every time, when I change a badge value. All is fine now, except little visible shift on start.

merry_ejik
  • 491
  • 6
  • 8