we're trying to center the tab bar icons to the tab bar center because we don't want to have the text below. So the icons should be alone and centered in the tab bar. This is how they look now. The tab bar controller is not the root viewcontroller, so we can't access it directly using rootviewcontroller as many responses we've found out there. Any ideas? We're turning crazy...
To remove titletext, you can use code:
let tabBarItems = tabBar.items! as [UITabBarItem]
tabBarItems[0].title = nil
To get center of icon tabs, use this code
let tabBarItems = tabBar.items! as [UITabBarItem]
tabBarItems[0].imageInsets = UIEdgeInsetsMake(6,0,-6,0)
for complete code remove titletext and get center icon
let tabBarItems = tabBar.items! as [UITabBarItem]
tabBarItems[0].title = nil
tabBarItems[0].imageInsets = UIEdgeInsetsMake(6,0,-6,0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With