spencer
spencer

Reputation: 1

UITabBarItem - Position image separately from title text

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?

Upvotes: 0

Views: 95

Answers (1)

Patrick Haertel
Patrick Haertel

Reputation: 329

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)

Upvotes: 1

Related Questions