Commit 514fb312 authored by jzhang's avatar jzhang

navigationbar适配iOS15

parent 731dd92d
......@@ -12,6 +12,23 @@ class BaseNavigationController: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
let titleTextAttributes: [NSAttributedString.Key: Any] = [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 22), NSAttributedString.Key.foregroundColor: UIColor.white]
navigationBar.isTranslucent = false
navigationBar.titleTextAttributes = titleTextAttributes
navigationBar.barTintColor = kMainColor
navigationBar.tintColor = UIColor.white
if #available(iOS 13.0, *) {
let appearance = UINavigationBarAppearance()
// 设置导航栏背景色
appearance.backgroundColor = kMainColor
// 字体颜色、尺寸等
appearance.titleTextAttributes = titleTextAttributes
// 带scroll滑动的页面
navigationBar.scrollEdgeAppearance = appearance
// 常规页面
navigationBar.standardAppearance = appearance
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment