123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- 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)
-
- changeTheming()
- }
-
- @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 = UINavigationBarAppearance()
-
- navBarAppearance.configureWithOpaqueBackground()
- navBarAppearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor : NCBrandColor.sharedInstance.textView]
- navBarAppearance.backgroundColor = NCBrandColor.sharedInstance.tabBar
- navigationBar.scrollEdgeAppearance = navBarAppearance
- 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()
- }
- }
|