ZLNavigationController.swift 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //
  2. // ZLNavigationController.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 16/6/16.
  6. // Copyright © 2016年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. class ZLNavigationController: UINavigationController {
  10. override func viewDidLoad() {
  11. super.viewDidLoad()
  12. self.navigationBar.isTranslucent = false
  13. self.navigationBar.barTintColor = navbar_barTint_color
  14. self.navigationBar.tintColor = navbar_tint_color
  15. self.navigationBar.titleTextAttributes = [NSAttributedString.Key.font:navbar_text_font,NSAttributedString.Key.foregroundColor:navbar_tint_color]
  16. self.toolbar.barTintColor = navbar_barTint_color
  17. self.toolbar.tintColor = navbar_tint_color
  18. self.toolbar.barStyle = .default
  19. // //隐藏返回按钮文字
  20. let barItem = UIBarButtonItem.appearance()
  21. let offset = UIOffset(horizontal: -200, vertical: 0)
  22. barItem.setBackButtonTitlePositionAdjustment(offset, for: .default)
  23. barItem.setTitleTextAttributes([
  24. NSAttributedString.Key.font:navbar_item_font,
  25. NSAttributedString.Key.foregroundColor:navbar_tint_color
  26. ], for:UIControl.State())
  27. }
  28. override func pushViewController(_ viewController: UIViewController, animated: Bool) {
  29. if viewControllers.count > 0 {
  30. viewController.hidesBottomBarWhenPushed = true
  31. }
  32. super.pushViewController(viewController, animated: animated)
  33. }
  34. override var preferredStatusBarStyle : UIStatusBarStyle {
  35. return .lightContent
  36. }
  37. // override func childViewControllerForStatusBarStyle() -> UIViewController? {
  38. // return self.topViewController
  39. // }
  40. }