我有一个 UITabBarController。它有两个选项卡。它们被标记为“FirstTitle”和“SecondTitle”。我怎样才能知道这些标题的默认字体大小是多少?
在 ViewDidLoad 中,对于我的第一个视图控制器(对应于我的第一个选项卡),我尝试过:
print(self.tabBarController?.tabBar.items?[0].titleTextAttributes(for:
.normal))
print(self.tabBarController?.tabBar.items?[0].titleTextAttributes(for:
.selected))
let appearance = UITabBarItem.appearance()
print(appearance.titleTextAttributes(for: .normal))
Run Code Online (Sandbox Code Playgroud)
所有这些都返回“nil”。此外,Main.storyboard 中任何位置显示的选项卡栏都没有默认字体大小。