MainNavigationController.swift 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //
  2. // MainNavigationController.swift
  3. // JSJP_Student_sw
  4. //
  5. // Created by Ning.ge on 2023/5/30.
  6. //
  7. import UIKit
  8. import RxSwift
  9. final class MainNavigationController: UINavigationController {
  10. override func viewDidLoad() {
  11. super.viewDidLoad()
  12. self.interactivePopGestureRecognizer?.delegate = self
  13. self.navigationBar.setBackgroundImage(UIImage.size(CGSize(width: 1, height: 1)).color(UIColor.white).image, for: .default)
  14. self.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor:UIColor.db_lightBlack]
  15. }
  16. override func pushViewController(_ viewController: UIViewController, animated: Bool){
  17. if children.count > 0 {
  18. viewController.hidesBottomBarWhenPushed = true
  19. let backItem = UIBarButtonItem(image: NYImage.Home.back?.withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(back))
  20. viewController.navigationItem.leftBarButtonItems = [backItem]
  21. }
  22. super.pushViewController(viewController, animated: animated)
  23. }
  24. @objc private func back() {
  25. self.popViewController(animated: true)
  26. }
  27. }
  28. //extension MainNavigationController: UIGestureRecognizerDelegate {}