[英]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.