How In-Call status bar impacts UIViewController's view size?

。_饼干妹妹 提交于 2019-11-27 13:11:37

The height of the view when the In-call status bar is toggled depends on the way it's anchored.

Play around with the autoResizingMask of the UIView to control whether the view should move down or resize when the in-call status bar shows up.

These two properties,

UIViewAutoresizingFlexibleTopMargin
UIViewAutoresizingFlexibleHeight  

will help you. The first one pushes the view down, the second one changes the size.

Your regular UIViewController example has [wantsFullScreenLayout] set to NO, which causes the view to be automatically sized so it doesn't go under the status bar.

UINavigationController and UITabBarController, on the other hand, default wantsFullScreenLayout to YES. So their views take up the whole window, and they size and position their subviews themselves to appropriately handle the status bar. If you explicitly set the property on these controllers to NO, you should get the behavior you desire (but will then lose the ability to properly handle child controllers that set wantsFullScreenLayout to YES, if you care about that).

In your UITabBarController example, BTW, it seems that you are not printing the information for the view of the tab bar controller; here that is a UILayoutContainerView, not a plain UIView.

Ideally you should forget about how much amount the view gets resized and play around with Autoresizing mask.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!