UITabBarItem 默认带有自定义标题

UITabBarItem default with custom title

我正在尝试一段时间,我的 swift iOS 应用程序中确实有一个包含三个元素的 UiTabBar,我想在每个 TabBarItem 中使用默认图像,但结合自定义标题。在 StoryBoard 中不可能这样做,所以我尝试对每个页面的 ViewControllerClass 中的每个元素都这样做。举个例子:

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

你们中有人知道如何将两者结合起来的技巧吗?似乎无法组合默认图像和自定义标题...

来自 Apple 文档 (https://developer.apple.com/documentation/uikit/uitabbaritem/systemitem):

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

据推测,这是因为 Apple 喜欢应用程序保持一致。他们不希望用户看到一个不符合预期的通用系统图标而感到困惑。