Reputation: 132
I refactored my storyboard and now I'm unable to set the badge value on the refactored storyboard.
This is the main story board and MessageCenter is the refactored storyboard.
Message Center StoryBoard:
I'm setting the badge value in the app delegate, which isn't working:
if let tabBarController = self.window!.rootViewController as? UITabBarController { tabBarController.tabBar.items!2.badgeValue = "3" }
Any ideas?
Upvotes: 0
Views: 670
Reputation: 1116
Try with this code in your TabBarCustomViewController:
DispatchQueue.main.async(execute: {
self.tabBar.items?[3].badgeValue = "3"
})
Upvotes: 1
Reputation: 96
if let tabBarController = self.window?.rootViewController as? UITabBarController { tabBarController.viewControllers?[2].tabBarItem.badgeValue = "3" }
Upvotes: 0