Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display only text without image for UITabBarItem?

I want to display only title for tabbar item without image. Is it possible? When I tried setting

let tabItem = UITabBarItem()
tabItem.title = "Tab1"
tabItem.selectedImage = nil
tabItem.image = nil
tabViewController?.tabBarItem = tabItem

I'm just getting a blank space which is tapable, but no title or image.

like image 858
JMS Avatar asked Oct 23 '25 02:10

JMS


2 Answers

simplest way is remove the images from the tab bar and set the custom offset vertical.as shown in the image. or else follow the link that TJ3n priveded remove the images in the UITabBarItem and aligned vertically the title.

enter image description here

like image 115
adarshaU Avatar answered Oct 24 '25 17:10

adarshaU


In case you want it to be done programmatically:

tabItem.titlePositionAdjustment = UIOffset(horizontal: 0, vertical: -16)
like image 40
AlexanderZ Avatar answered Oct 24 '25 17:10

AlexanderZ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!