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

后端 未结 3 1795
傲寒
傲寒 2020-12-03 03:24

I\'m trying to understand how the view associated to a UITabBarController, UINavigationController or UIViewController rea

相关标签:
3条回答
  • 2020-12-03 03:44

    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.

    0 讨论(0)
  • 2020-12-03 03:45

    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.

    0 讨论(0)
  • 2020-12-03 03:54

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

    0 讨论(0)
提交回复
热议问题