Reputation: 1034
I have a view controller which is the rootVc for Navigation Controller.
I needed the navigation bar to be hiddden for the rootview controller hence I used the following method to hide it and make it reappear.
override func viewWillAppear(_ animated: Bool) {
self.navigationController?.setNavigationBarHidden(true, animated: false)
}
override func viewWillDisappear(_ animated: Bool) {
self.navigationController?.setNavigationBarHidden(false, animated: false)
}
I'm basically hiding the navigation bar in the rootVc and showing it for all other view controllers.
But when I remove the NavBar I see that my content is extending under the status bar
Is there a way to fix this?
Upvotes: 1
Views: 645
Reputation: 1069
Instead of setting the top constraint to superView use safe area. Something like this
Upvotes: 2