BB9z / iOS-Project-Template

iOS 项目模版,MVC iOS project done right.

Home Page:https://github.com/BB9z/iOS-Project-Template/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

导航样式方案升级,对齐 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