1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- import Foundation
- class NCMainNavigationController: UINavigationController {
-
- var isPushing = false
- required init?(coder: NSCoder) {
- super.init(coder: coder)
-
- NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil)
-
- changeTheming()
- }
- @objc func changeTheming() {
-
- if #available(iOS 13.0, *) {
-
- var navBarAppearance = UINavigationBarAppearance()
-
- navBarAppearance.configureWithOpaqueBackground()
- navBarAppearance.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor : NCBrandColor.shared.textView]
- navBarAppearance.backgroundColor = NCBrandColor.shared.backgroundView
-
- navBarAppearance = UINavigationBarAppearance()
-
- navBarAppearance.configureWithOpaqueBackground()
- navBarAppearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor : NCBrandColor.shared.textView]
- navBarAppearance.backgroundColor = NCBrandColor.shared.tabBar
- navigationBar.scrollEdgeAppearance = navBarAppearance
- navigationBar.standardAppearance = navBarAppearance
-
- } else {
-
- navigationBar.barStyle = .default
- navigationBar.barTintColor = NCBrandColor.shared.backgroundView
- navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor:NCBrandColor.shared.textView]
- navigationBar.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor:NCBrandColor.shared.textView]
- }
-
- navigationBar.tintColor = NCBrandColor.shared.brandElement
- navigationBar.setNeedsLayout()
- }
- }
|