iOS-Project-Template icon indicating copy to clipboard operation
iOS-Project-Template copied to clipboard

导航样式方案升级,对齐 iOS 15+ 行为

Open BB9z opened this issue 2 years ago • 0 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

BB9z avatar Nov 01 '23 00:11 BB9z