0
votes

I have a UITabBar with 5 UITabBarItems, each containing an image and a title. Currently, the images are positioned centered above the title text. When an item is selected I bold the text, however this causes the positioning of the image to change slightly since the text now takes up more space. How can I divorce the positioning of these two elements in a UITabBarItem?

1
Where is your code tried? Share your codeAbdelahad Darwish
Currently, it's all done in a storyboard except for changing the title font, which is just a call to UITabBarItem.appearance().setTitleTextAttributes.spencer

1 Answers

1
votes

Try adjusting the image insets to get your desired look.

For example, you could try:

tabBarItem.imageInsets = UIEdgeInsets(top: -1, left: 0, bottom: 1, right: 0)