// // WP_RootVC.swift // WallpaperHD_Live // // Created by 忆海16 on 2024/7/22. // import UIKit class WP_RootVC: UIViewController { override func viewDidLoad() { super.viewDidLoad() setNavigtionContrilerBase() } func setNavigtionContrilerBase(){ self.navigationController?.navigationBar.barTintColor = .white let titleTextAttributes = [ NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16, weight: .bold), NSAttributedString.Key.foregroundColor: UIColor.black ] ///控制导航栏的背景颜色和底部线的隐藏 if #available(iOS 13.0, *) { let appearance = UINavigationBarAppearance() appearance.configureWithOpaqueBackground() //重置导航栏背景颜色和阴影 appearance.backgroundColor = UIColor.white appearance.shadowImage = UIImage() appearance.shadowColor = nil appearance.titleTextAttributes = titleTextAttributes self.navigationController?.navigationBar.standardAppearance = appearance self.navigationController?.navigationBar.scrollEdgeAppearance = appearance } else { self.navigationController?.navigationBar.barTintColor = UIColor.white self.navigationController?.navigationBar.titleTextAttributes = titleTextAttributes self.navigationController?.navigationBar.shadowImage = UIImage() self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) } } override var preferredStatusBarStyle : UIStatusBarStyle { return .lightContent } }