| | |
| | | class BaseNav: UINavigationController,UINavigationControllerDelegate { |
| | | |
| | | /// 需要透明Nav的VC |
| | | private var lucencyVCs = [HomeVC.self] |
| | | private var lucencyVCs = [HomeVC.self,LoginVC.self,CommonWebVC.self] |
| | | |
| | | private let img = UIImage.jq_gradient(["#B6E0FF","#FFFFFF"],size: CGSize(width: JQ_ScreenW, height: 90),direction: GradientDirection.vertical) |
| | | |
| | |
| | | navigationBar.setBackgroundImage(UIImage(), for: .default) |
| | | navigationBar.shadowImage = UIImage() |
| | | } |
| | | |
| | | // let titleV = UIView() |
| | | // titleV.sizeToFit() |
| | | // let imgV = UIImageView(image: UIImage(named: "bg_logo")) |
| | | // imgV.contentMode = .scaleAspectFit |
| | | // titleV.addSubview(imgV) |
| | | // imgV.snp.makeConstraints { make in |
| | | // make.edges.equalToSuperview() |
| | | // } |
| | | // |
| | | // navigationItem.titleView = titleV |
| | | } |
| | | |
| | | open func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) { |
| | |
| | | override var preferredStatusBarStyle: UIStatusBarStyle{ |
| | | return .lightContent |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | class LoginNav: UINavigationController,UINavigationControllerDelegate { |
| | | |
| | | private var popDelegate: UIGestureRecognizerDelegate? |
| | | |
| | | open override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | self.navigationBar.barTintColor = .white |
| | | self.navigationBar.titleTextAttributes = [.font:UIFont.systemFont(ofSize: 18, weight: .medium), .foregroundColor:UIColor.black] |
| | | self.navigationBar.tintColor = UIColor.black |
| | | self.navigationBar.shadowImage = UIImage() |
| | | self.navigationBar.isTranslucent = true |
| | | self.delegate = self |
| | | self.popDelegate = self.interactivePopGestureRecognizer?.delegate |
| | | |
| | | |
| | | if #available(iOS 15.0, *) { |
| | | |
| | | let scrollBar = UINavigationBarAppearance() |
| | | scrollBar.configureWithOpaqueBackground() |
| | | scrollBar.backgroundEffect = nil |
| | | scrollBar.shadowColor = nil |
| | | scrollBar.titleTextAttributes = [.foregroundColor:Config.ThemeColor,.font:Config.NavFont] |
| | | scrollBar.backgroundColor = UIColor.clear |
| | | // scrollBar.backgroundImage = img |
| | | |
| | | |
| | | let standardBar = UINavigationBarAppearance() |
| | | standardBar.configureWithOpaqueBackground() |
| | | standardBar.backgroundEffect = nil |
| | | standardBar.shadowColor = nil |
| | | standardBar.shadowImage = nil |
| | | standardBar.titleTextAttributes = [.foregroundColor:Config.ThemeColor,.font:Config.NavFont] |
| | | standardBar.backgroundColor = UIColor.clear |
| | | // standardBar.backgroundImage = img |
| | | |
| | | navigationBar.scrollEdgeAppearance = scrollBar //顶部透明 |
| | | navigationBar.standardAppearance = standardBar |
| | | |
| | | |
| | | }else { |
| | | navigationBar.titleTextAttributes = [.foregroundColor:Config.ThemeColor,.font:Config.NavFont] |
| | | } |
| | | } |
| | | |
| | | open func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) { |
| | | |
| | | |
| | | } |
| | | |
| | | //侧滑 |
| | | public func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) { |
| | | if viewController == self.viewControllers[0] { |
| | | self.interactivePopGestureRecognizer!.delegate = self.popDelegate |
| | | }else{ |
| | | self.interactivePopGestureRecognizer!.delegate = nil |
| | | } |
| | | } |
| | | |
| | | open override var childForStatusBarHidden: UIViewController? { |
| | | return self.topViewController |
| | | } |
| | | |
| | | open override var childForStatusBarStyle: UIViewController? { |
| | | return self.topViewController |
| | | } |
| | | |
| | | } |