无法创建透明的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
结果,我得到了这个:
预期结果:NavigationBar应该是透明的
为我工作:
self.compactAppearance = appearance
self.standardAppearance = appearance
self.scrollEdgeAppearance = appearance
self.backgroundColor = appearance.backgroundColor
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句