iOS透明导航栏13

问题描述 投票:0回答:3

无法创建透明的NavigationBar iOS 13。

我有自定义UINavigationBar,在其中配置UINavigationBarAppearance

override init(frame: CGRect) {
    super.init(frame: frame)
    self.configure()
}

required init?(coder: NSCoder) {
    super.init(coder: coder)
    self.configure()
}

配置代码:

let appearance = UINavigationBarAppearance()
appearance.configureWithTransparentBackground()
appearance.shadowColor = .clear
appearance.backgroundColor = .clear

并将其设置为:

self.compactAppearance = appearance
self.standardAppearance = appearance
self.scrollEdgeAppearance = appearance

结果,我得到了这个:

enter image description here

预期结果:NavigationBar应该透明

ios swift uinavigationbar ios13 uinavigationbarappearance
3个回答
0
投票
let appearance = UINavigationBarAppearance() appearance.configureWithTransparentBackground() appearance.shadowColor = .clear appearance.backgroundColor = .clear appearance.backgroundImage = nil appearance.shadowImage = nil

0
投票

0
投票
© www.soinside.com 2019 - 2024. All rights reserved.