【发布时间】:2019-09-30 19:40:15
【问题描述】:
我用这段代码让tabBar清晰:
self.tabBarController?.tabBar.backgroundImage = UIImage()
self.tabBarController?.tabBar.shadowImage = UIImage()
但在 iOS 13 中,我的代码不起作用。我尝试使用此代码:
if #available(iOS 13, *) {
let appearance = self.tabBarController?.tabBar.standardAppearance.copy()
appearance!.backgroundImage = UIImage()
appearance!.shadowImage = UIImage()
appearance!.shadowColor = .clear
self.tabBarController?.tabBar.standardAppearance = appearance!
} else {
self.tabBarController?.tabBar.backgroundImage = UIImage()
self.tabBarController?.tabBar.shadowImage = UIImage()
}
但在这种情况下,我的 tabBar 有白色,不清楚。
【问题讨论】:
-
向下滚动以讨论 iOS 13 中的新外观 API:stackoverflow.com/questions/56839374/…
-
@Koen 如果我使用stackoverflow.com/a/58088270,我会得到相同的结果。白色标签栏。我将
.white更改为.clear -
你试过没有
backgroundImage吗? -
@Koen 是的。我尝试了不同的变体,但它不起作用。为什么?
-
抱歉,不知道。但也许这会有所帮助:sarunw.com/posts/uinavigationbar-changes-in-ios13。这是关于
UINavgationBar的 API 更改,但也许其中有一些提示可以帮助您。