dismiss view controller UINavigationBar overlaps with status bar? - ios

When I dismiss viewcontroller Navigation bar overlaps with status bar how to solve this issue ?

self.navigationController?.navigationBarHidden = true
add this code in your first view Controller

Related

Hide Tabbar Controller Tabbar iOS issue

I have a tabbar controller with 3 tabs, each tab has navigation controller, on root view controller of each navigation controller i want tabbar and on other view controller in same navigation controller i dont want tabbar.
Any solution?
set self.tabBarController?.tabBar.isHidden = true in viewWillAppear method of your controller when you don't want tabbar
override func viewWillAppear(_ animated: Bool) {
self.tabBarController?.tabBar.isHidden = true
}
Setting alpha value 0 to tab Bar hides all items and including tab bar
You should set the tabbar alpha to 0. This will hide the UITabBar.
However you need to set isUserInteractionEnabled to false since even when its hided, the buttons are there & clickable still!
Hope this helps!
Set Transculent property of Tab bar to true or check the same from storyboard
Set hidesTabbarWhen Pushed property of Tab bar to true or check the same from storyboard
Set Tab bar hidden true on view controller where you want Tab bar and set Tab bar hidden to false on view controller where you don't want Tab bar

Status bar won't hide if view controller is presented

I have multiple storyboards in my project. I have a home page view controller in one storyboard, and I have a Setup view controller embedded in a navigation controller in a separate storyboard. Now when I Present the setup view controller navigation controller from the homepage view controller, the status bar won't hide. But when I set the setup view controllers storyboard as the main storyboard file base in the info.plist and the setup view controller navigation controller is the first view presented then the status bar will hide. I'm using the code below to hide the status bar. Can someone show me how to hide the status bar when the status view controller is presented by another storyboard view controller instead of being set as the first view controller. Here is the code I'm using to hide the status bar,
override var prefersStatusBarHidden: Bool {
return true
}
You can hide status bar in a condition.. You need to add another Window Object over the status bar.
let stautsBarWindow = UIWindow(frame: UIScreen.main.bounds)
stautsBarWindow.backgroundColor = UIColor.clear
//Instead of Presenting just assign your viewController in below line it will hide your statusBar as well.
stautsBarWindow.rootViewController = yourSideMenuViewController
stautsBarWindow.windowLevel = UIWindowLevelStatusBar
stautsBarWindow.isHidden = false

Navigation controller with tab bar controller of navigation controller

I have a navigation controller, and its root view controller is a tab bar controller. In this tab bar controller I have two view controllers like this:
In the tab bar controller I have a custom navigation bar.
When I click the first item in tab bar, the navigation bar looks good
but when I click the second, I have a problem: below the navigation bar there is another navigation bar with red color.
Can some explain this for me?
If you don't want navigation bar of first navigation controller then from the interface builder (storyboard) select your root navigation controller (i.e. navigationcontroller that's embed with tabbarcontroller) and from attribute inspector uncheck shows navigation bar under Navigation controller! This will hide navigation bar for root navigation view controller!!
In your case you should hide and show navigation bar in viewWillDisAppear and viewWillAppear something like,
In viewWillAppear
self.navigationController.navigationBar.hidden = NO;
In viewWillDisAppear
self.navigationController.navigationBar.hidden = YES;
Do above things for your both viewcontroller of your tabbarcontroller!!
You can do navigationController.navigationBarHidden = true on the root navigation controller, or the child whatever suits you.
But the better will be if you use only one UINavigationController, and IMO navigationController of UITabBarController only.

Navigation Based App With Tab Hidden

How to hide tabbar in Navigation Flow?
self.tabbarController.tabbar.hidden = true
This is not working. I called this from ViewWillAppear method.
Just check the Hide Bottom Bar on Push for your ViewController if you're using storyboard

Completely disable the Navigation Controller

I have used the 'Embed In' navigation controller within the storyboard. Is there a way to completely disable the whole navigation bar? I have tried the code below, but when there is a swipe, the navigation bar appears again. I want to be able to completely hide the whole bar until a condition is met. Is there a way to do this?
self.navigationController?.hidesBarsOnSwipe = true
self.navigationController?.hidesBarsOnTap = true
I have tried a custom navigation bar, but I couldn't get a nice scroll effect like with the default navigation bar.
To hide the navigationBar just do:
self.navigationController?.navigationBar.isHidden = true
Add this row in your viewDidLoad.
You can use this in viewDidLoad:
self.navigationController?.setNavigationBarHidden(true, animated: false)

Resources