gpt4 book ai didi

swift - iOS13 中的 iOS TabBar 项目标题问题

转载 作者:行者123 更新时间:2023-11-28 05:35:55 24 4
gpt4 key购买 nike

我在从 Xcode 11 编译时在 iOS13 的 tabBar 标题中遇到问题。从 Xcode 10 编译时它工作完美。请找到问题的屏幕截图,下面是自定义 tabBar 的代码。

enter image description here

代码是

self.tabBar.isTranslucent = true
self.tabBar.tintColor = UIColor.white
UITabBarItem.appearance().badgeColor = Constant.Colors.colorFF1744
if #available(iOS 13, *) {
let appearance = UITabBarAppearance.init()
appearance.stackedLayoutAppearance.normal.titleTextAttributes = [NSAttributedString.Key.font:UIFont(name: Constant.FontNames.RubikRegular, size: Constant.FontSize.P5heading)!,NSAttributedString.Key.foregroundColor:Constant.Colors.color8D8D8D]
appearance.stackedLayoutAppearance.selected.titleTextAttributes = [NSAttributedString.Key.font:UIFont(name: Constant.FontNames.RubikRegular, size:Constant.FontSize.P5heading)!,NSAttributedString.Key.foregroundColor:Constant.Colors.colorFF1744]
appearance.stackedItemPositioning = .automatic
self.tabBar.standardAppearance = appearance
} else {
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.font:UIFont(name: Constant.FontNames.RubikRegular, size: Constant.FontSize.P5heading)!, NSAttributedString.Key.foregroundColor:Constant.Colors.color8D8D8D], for: .normal)
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.font:UIFont(name: Constant.FontNames.RubikRegular, size: Constant.FontSize.P5heading)!, NSAttributedString.Key.foregroundColor:Constant.Colors.colorFF1744], for: .selected)
}

最佳答案

删除您的 if#available(iOS 13, *) 并按照与在 iOS 12 中相同的方式执行此操作。新方法 UITabBarAppearance 充满了错误。避免它,直到它们被修复。

关于swift - iOS13 中的 iOS TabBar 项目标题问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58641202/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com