Mikael
Mikael

Reputation: 2395

UINavigationBar moves under status bar when using swipe back gesture from status bar hidden viewController

The problem is simple, the Profile viewController has a NavigationBar just under the status bar. I push another viewController on top of the current one. This new viewController hides the status bar.

When I go back USING A SWIPE BACK GESTURE to the Profile viewController, the navigationBar has moved up by the size of the status bar height.

enter image description here

The related question is UINavigationBar moving under status bar when another viewController hides status bar

Any ideas?

Upvotes: 0

Views: 167

Answers (1)

Mikael
Mikael

Reputation: 2395

Actually,

in that case too, using the following also works.

[[UIApplication sharedApplication] setStatusBarHidden:NO];

Calling this in viewWillDisappear of the second view controller solves the issue. The main View controller contains a main view and I add a tableView in within the view (the blue-ish color on the screenshot is the header of the tableview).

Somehow, this composition doesn't layout really well... I have no idea why. Somebody wrote that to avoid this kind of layout issues, using a scrollView as a container makes the trick but I can't add tableViews to a scrollView...

If anybody has an explanation about why this layout problem happens, I'd be happy about it.

Upvotes: 0

Related Questions