Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITabBarItem default with custom title

I am trying this for a while now, I do have a UiTabBar with three elements in my swift iOS app and I would like to use default images every TabBarItem, but combined with a custom title. It is not possible to do this in the StoryBoard, so I try to do this for every element in the ViewControllerClass of every page. Just one example:

self.tabBarItem = UITabBarItem.init(tabBarSystemItem: UITabBarSystemItem.bookmarks, tag: 0)
self.tabBarItem.title = "Test"

Does anybody of you know a trick how to combine both of it? It seems like it's not possible to combine default images and custom titles...

like image 315
Hemmelig Avatar asked Oct 19 '25 13:10

Hemmelig


1 Answers

From Apple docs (https://developer.apple.com/documentation/uikit/uitabbaritem/systemitem):

The title and image of system tab bar items cannot be changed.

Presumably, this is because Apple likes apps to be consistent. They don't want users to be confused by seeing a common system Icon that doesn't do what it's expected to do.

like image 135
DonMag Avatar answered Oct 21 '25 04:10

DonMag



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!