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?
Asked
Active
Viewed 85 times
0
-
2Where is your code tried? Share your code – Abdelahad Darwish May 31 '18 at 20:12
-
Currently, it's all done in a storyboard except for changing the title font, which is just a call to UITabBarItem.appearance().setTitleTextAttributes. – spencer May 31 '18 at 20:17
1 Answers
1
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)

Patrick Haertel
- 309
- 4
- 15