UITabBar pushed down below screen when starting app while in a phone call
Asked Answered
H

2

7

When my app is started while the user is in a phone call, the whole app is pushed down below the green Phone-call-bar. The root of my app is a UITabViewController and the Tabs now appear partly below the Screen. The worst part of it is that after the phone call is ended, the view now takes up full screen space, but the Tab Bar is still partly below the screen! The even more strange thing is that when the app is started and the user receives a phone call or leaves the app, makes one and return to the app while the call is active, it resizes as expected. (So this only occurs when starting the app from scratch while a call is active)

The only post I could see regarding this was How In-Call status bar impacts UIViewController's view size?

One of the answers suggested changing the Autoresizing mask:

public override func viewDidLoad() {
    super.viewDidLoad()
    self.view.autoresizingMask = .flexibleHeight
}

In my UITabBarController, but it changed nothing.

Another answer suggested setting wantsFullScreenLayout to false, which is default for regular UIViewControllers but not for UITabBarControllers. However this property was deprecated in iOS 7 and it suggests using edgesForExtendedLayout and extendedLayoutIncludesOpaqueBars instead.

I don't find enough information there to understand how I should solve this problem. Does anyone have an idea?

Note: It would be quite explanatory with some images, but I cannot post those because it's not released now

Haberdashery answered 3/8, 2017 at 17:7 Comment(4)
Do you get the solution for the same, please let me know. I am facing the same problem.Exocentric
Can you reproduce the problem on a sample app to understand the problem?Christianechristiania
Can you attach ScreenShot and steps for reproduce? If you can sharing your code it also can help for search problem.Ludly
I cannot answer your question without more details. But it seems to me that the constraints of your views are set wrongly. To check this, I created a new Tabbed App project, and executed it on an iPhone 8 simulator, where a full-size in-call status bar is used. I double clicked the home button, and slided out the app to terminate it. I then selected Hardware/Toggle In-call Status Bar, and launched the test app again. It is displayed correctly. So, if you compare the constraints of your own app with those of the test app, you should get a hint what is wrong.Judd
D
0

Try this one:

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated);
    self.tabBar.invalidateIntrinsicContentSize();
}
Dedradedric answered 25/6, 2019 at 5:20 Comment(3)
Most problematic screen - is Launch Screen.Blunk
@SergeyHleb Are you keeping tabbar in launch screen?Dedradedric
No, but this is also part of the problem.Blunk
S
0

If the launch screen looks broken because of an ongoing call, you can fix it by either using a dynamically sized layout or temporarily hiding the status bar.

If you have an older project it is possible you still use launch images, in that case you can switch to a dynamically sized layout by doing as follows. Create a new storyboard with a single view controller that has the Is Initial View Controller checked. Make sure the view controller can handle different heights. Go to the target's general tab (in the project navigator select the top item, then to the right, select the target under Targets) and choose the newly created storyboard as the launch screen file.

If you instead want to temporarily hide the status bar on launch follow the directions on this page:
Hide status bar on launch image

Southward answered 26/6, 2019 at 13:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.