Stoph
Stoph

Reputation: 723

iOS Status Bar Height Incorrect when In a Call

I'm seeing an issue where if a user opens my app while they are in a call, or doing something else that causes the status bar to be double-height, the entire layout gets pushed down by the height of the status bar.

For example, if the user enters a call and they are already in the app, then the layout will look like this:

enter image description here

However, if a user is already in a call and they enter the app, the layout will look like this (the nav bar being cut off at the bottom of the image is part of the issue, not a problem with the screenshot):

enter image description here

All of my layouts have been created through a StoryBoard and are using AutoLayout. I have also recently reviewed and fixed any AutoLayout constraints that seemed to be bad or out of place.

If anyone has guidance about what might be going on, or a way to fix this, it would be much appreciated!

Upvotes: 2

Views: 653

Answers (2)

Jak
Jak

Reputation: 1433

In your main view controller, where your tab bar controller lives, make sure you override viewDidLayoutSubviews() and resize the UITabBarController as such:

override func viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews()
    self.myTabViewController.view.frame = self.view.bounds
}

Upvotes: 1

jay sharma
jay sharma

Reputation: 11

Use following:

func viewWillLayoutSubviews{
     self.view.layoutIfNeeded()
 }

Upvotes: 0

Related Questions