I have a navigation controller with 4 tab bar items. Each one has a navigation controller inside. I want to be able to change the 4th tab bar badge number when I get push notification, no matter in what view or tab am I. I need to use the auto-layout so I can’t use any programmatically solution inside the app delegate. I started the project from a single view template.
I tried to go to the desired tab, change the badge value and come back but of course it didn’t work.
The tabBarController seems to have only references to the current tab bar item.
var current = self.tabBarController?.selectedIndex
self.tabBarController?.selectedIndex = 3
self.navigationController?.tabBarItem.badgeValue = "34"
self.tabBarController?.selectedIndex = current!