导航样式方案升级,对齐 iOS 15+ 行为
BB9z opened this issue · comments
默认全透明,iOS 13-14 应用:
bar.tintColor = .red
// 标题
// os: 14-17 ok
let bg = UIImage(systemName: "square.fill")!
.withTintColor(.gray)
.withRenderingMode(.alwaysOriginal)
.resizableImage(withCapInsets: .zero, resizingMode: .tile)
bar.setBackgroundImage(bg, for: .default)
bar.backgroundColor = .clear
bar.shadowImage = UIImage()
let appear = UINavigationBarAppearance()
appear.backgroundColor = .clear
appear.backgroundEffect = nil
appear.backgroundImage = bg
appear.titleTextAttributes = [
.font: UIFont.italicSystemFont(ofSize: 24),
.backgroundColor: UIColor.orange,
.foregroundColor: UIColor.blue,
]
bar.standardAppearance = appear
bar.scrollEdgeAppearance = appear