Icons in the center of the No Text in Swift tab

we are trying to center the tab bar icons in the center of the tab bar because we don’t want the text below. Icons should be alone and centered in the tab bar. Here's what they look like now. The tab bar controller is not the root view controller, so we cannot access it directly using the rootviewcontroller, how many answers we found there. Any ideas? We're going crazy ...

+6
source share
1 answer

To remove the header, you can use the code:

let tabBarItems = tabBar.items! as [UITabBarItem] tabBarItems[0].title = nil 

To get the icon center tab, 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) 
+4
source

Source: https://habr.com/ru/post/984464/


All Articles