且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

UIViewAutoresizingNone:旋转后调整大小

更新时间:2023-01-15 12:35:24

请勿为此使用根视图,而应在视图控制器的视图中添加一个子视图. UIViewControllers通常旨在填充其容器的整个空间(在这种情况下为窗口).

Don't use the root view for this, add a subview to the view controller's view instead. UIViewControllers are typically designed to fill the entire space of their container (the window in this case).

例如,如果要将UIViewController添加到UINavigationController,则导航控制器将根据导航控制器的布局(无论导航栏是否可见等)来接管调整视图控制器视图大小的责任.我不确定UIWindow的行为如何(我认为这没有很清楚地记录下来),但是在SDK的很多地方,视图控制器的父级负责其子级的位置和大小(UIPopoverControllerUITabBarController等.)

For example, if you would add a UIViewController to a UINavigationController, the navigation controller takes over the responsibility to size the view controller's view according to the navigation controller's layout (whether the navigation bar is visible etc.). I'm not sure how exactly UIWindow behaves (I think this is not very clearly documented), but in a lot of places in the SDK, a view controller's parent is responsible for the positioning and size of its children (UIPopoverController, UITabBarController et.al.).