123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import Foundation
- class NCMainNavigationController: UINavigationController {
-
- 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, *) {
-
- let appearance = UINavigationBarAppearance()
-
- appearance.configureWithOpaqueBackground()
- appearance.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor : NCBrandColor.shared.textView]
- appearance.backgroundColor = NCBrandColor.shared.backgroundView
- appearance.configureWithOpaqueBackground()
- appearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor : NCBrandColor.shared.textView]
- appearance.backgroundColor = NCBrandColor.shared.tabBar
- navigationBar.scrollEdgeAppearance = appearance
- navigationBar.standardAppearance = appearance
-
- } 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 = .systemBlue
- navigationBar.setNeedsLayout()
- }
- }
|