Karan Alangat
Karan Alangat

Reputation: 2224

Status Bar getting hidden suddenly when changing the root view controller in iOS swift 4.2

when I set one login viewController as initial screen from AppDelegate class, it loads the same with status bar. But issue comes when I display the same from inner screen (when user selects a Log out option). I have set the View controller-based status bar appearance with value as NO.

Thanks in advance.

Upvotes: 2

Views: 472

Answers (1)

Karan Alangat
Karan Alangat

Reputation: 2224

Guys I found the answer by myself.

It was a scenario occurred with the library that I've been using, ie. SlideMenuControllerSwift. I've been using this library for displaying side menu in my application. The issue occurred, when user selects an option in side menu ("Log out"). After selecting this option, from the next screen onwards the status bar will be hidden.

The actual scenario was that, when user selects the menu button from Home screen, status bar will get hidden and the side menu will be displayed.

In background, once any option other than the Log out option is selected, the child view controller will be displayed using segues. When user selects the Log out option user will get navigated to Login screen. Here I've been changing the rootViewController of the window.

The trick was with the SlideMenuOptions.hideStatusBar property of SlideMenuControllerSwift library. We can use this property to show/hide the status bar, when user selects the Menu option that will display the side menu. By default, this was set as true and as I straight away change the root view controller, the status bar property has not been reset.

I changed this property to false, in application: application didFinishLaunchingWithOptions:, as my client wanted to display the side menu with status bar. In turn, this solved my status bar issue !! 😀

Upvotes: 2

Related Questions