user3010455
user3010455

Reputation: 55

UITabBar icons not aligned vertically since iOS 13

Ever since I updated Xcode my icons are not aligned on my UITabBar. The two end icons appear higher vertically than the two in the middle. I have not modified this bar whatsoever besides the icons. I thought it may be the icon size, but when I take the left icon and apply it to the 2nd image, the alignment is still off.

UITabBar 1 UITabBar 2

Upvotes: 3

Views: 2545

Answers (5)

mehmetdelikaya
mehmetdelikaya

Reputation: 109

I had the same problem when creating uitabbar items programmatically. I could vertically aligned the icons by giving empty string to titles.

let tabarItem = UITabBarItem()
tabBarItem.image = UIImage(named: "imgTabIcon")
tabBarItem.title = ""

Upvotes: 1

khanh.tran.vinh
khanh.tran.vinh

Reputation: 665

I had this problem going from Xcode 10 to 11 the issue turned out to be I had a whitespace character for the Bar Item's title. Just click the 'Title' textfield and delete the text if something is there, to make sure there isn't whitespace character.

enter image description here

Upvotes: 2

deepnet
deepnet

Reputation: 1

I had the same problem, with an older iOS app created in 2017 (3 years old). I just deleted the tabbar, recreated it in Storyboard, reassigned all the tab bar items, and that fixed it. I suspect there is a problem with the older conversion of storyboards with uitabbars.

Upvotes: 0

krichards
krichards

Reputation: 41

You can set the bar item's image inset through the storyboard.
Storyboard Bar Item Image Inset

Upvotes: 2

Munzareen Atique
Munzareen Atique

Reputation: 480

Take fix size images its due to space in image. Tabbar always shows the same size which we provide it. Check your icon images there must be space in images.

Upvotes: 1

Related Questions