[英]Transparent navigation bar iOS 13
无法创建透明 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
将外观代码修改为:-
let appearance = UINavigationBarAppearance()
appearance.configureWithTransparentBackground()
appearance.shadowColor = .clear
appearance.backgroundColor = .clear
appearance.backgroundImage = nil
appearance.shadowImage = nil
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.