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