I have issue with Navigation Controller inside TabBarController. I have 5 view controllers and 3 of them have navigation bar. I need to make white status bars of all of this 3 VC. And i can do it with
self.navigationController?.navigationBar.barStyle = UIBarStyle.black
But here is the problem. When i push another View Controller and return back my status bar again become black
Here is my code for every VC
1st VC:
override func viewDidLoad() {
super.viewDidLoad()
setupSearchBar()
setupTableView()
createAd()
let label = UILabel()
label.textColor = UIColor.white
label.text = "Library"
label.font = UIFont.boldSystemFont(ofSize: 35)
if #available(iOS 13.0, *) {
// Always adopt a light interface style.
overrideUserInterfaceStyle = .light
}
navigationItem.leftBarButtonItem = UIBarButtonItem.init(customView: label)
navigationItem.rightBarButtonItem = UIBarButtonItem.init(image: UIImage(named:"settingsButton"), style: .plain, target: self, action: #selector(self.action(sender:)))
self.navigationController?.navigationBar.barStyle = UIBarStyle.black
}
2nd VC:
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.navigationBar.barStyle = UIBarStyle.black
configureSegmentsContainer()
configurSegments()
setupCollectionView()
if #available(iOS 13.0, *) {
// Always adopt a light interface style.
overrideUserInterfaceStyle = .light
}
}
and 3rd:
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.navigationBar.barStyle = UIBarStyle.black
setupTabelView()
configure()
setupNavBar()
if #available(iOS 13.0, *) {
// Always adopt a light interface style.
overrideUserInterfaceStyle = .light
}
}
What I am doing wrong and how i can fix it. PLS HELP
2
Answers
Solution 1
Solution 2
embed vc1 in BaseNavigationController and but not the other two just simple push vc2 or more
Try like this i believe it will help you.