Since I upgraded my iPad operating system, the title of the UITabBar of my app is showing truncated, as shown in the screenshot.
I have tried some methods, but I have not found the correct solution.
Hope someone can help me.
And Here is code:
func setupTabBar() {
if #available(iOS 13, *) {
let appearance = tabBar.standardAppearance
appearance.configureWithOpaqueBackground()
appearance.backgroundImage = UIImage(color: .white)
appearance.shadowImage = UIImage(color: .clear)
let normalAttrs: [NSAttributedString.Key: Any] = [.foregroundColor: ThemeColor.gray]
let selectedAttrs: [NSAttributedString.Key: Any] = [.foregroundColor: ThemeColor.red]
appearance.stackedLayoutAppearance.selected.titleTextAttributes = selectedAttrs
appearance.stackedLayoutAppearance.normal.titleTextAttributes = normalAttrs
appearance.inlineLayoutAppearance.selected.titleTextAttributes = selectedAttrs
appearance.inlineLayoutAppearance.normal.titleTextAttributes = normalAttrs
appearance.compactInlineLayoutAppearance.selected.titleTextAttributes = selectedAttrs
appearance.compactInlineLayoutAppearance.normal.titleTextAttributes = normalAttrs
UITabBar.appearance().standardAppearance = appearance
} else {
tabBar.backgroundImage = UIImage(color: .white)
tabBar.shadowImage = UIImage(color: .clear)
}
if #available(iOS 15, *) {
UITabBar.appearance().scrollEdgeAppearance = UITabBar.appearance().standardAppearance
}
}