Reputation: 723
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:
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):
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
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
Reputation: 11
Use following:
func viewWillLayoutSubviews{
self.view.layoutIfNeeded()
}
Upvotes: 0