Remove tab bar item text, show only image Remove tab bar item text, show only image ios ios

Remove tab bar item text, show only image


You should play with imageInsets property of UITabBarItem. Here is sample code:

let tabBarItem = UITabBarItem(title: nil, image: UIImage(named: "more")tabBarItem.imageInsets = UIEdgeInsets(top: 9, left: 0, bottom: -9, right: 0)

Values inside UIEdgeInsets depend on your image size. Here is the result of that code in my app:

enter image description here


// Remove the titles and adjust the inset to account for missing titlefor(UITabBarItem * tabBarItem in self.tabBar.items){    tabBarItem.title = @"";    tabBarItem.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0);}


Here is how you do it in a storyboard.

Clear the title text, and set the image inset like the screenshot below

enter image description here

Remember the icon size should follow the apple design guideline

enter image description here

This means you should have 25px x 25px for @1x, 50px x 50px for @2x, 75px x 75px for @3x