Search code examples
iosswiftuitabbarcontrollertabbartabitem

TabBar icons are vertically unaligned


I have a UITabBarController with 5 buttons. For some reason, the icons are not aligned vertically, and I can't figure out why. I checked Google and StackOverflow for a good solution, nothing worked from there yet.

I also tried to change all icons to be the same, and they still have the same gaps.

All icons are vectors (PDF)

Attached screenshots from the User Interface inspector and the app.

tab2 tab1


Solution

  • I found a solution to this issue, and it's not about the icons.

    All you need to do, is to define EMPTY STRING to the item's title.

    Before:

    tabBarItem.title = nil
    

    After:

    tabBarItem.title = ""