How to adjust the orientation of UIViewControllerWrapperView (in IOS7)?

Background: The application is an iPad app running in Landscape only. When upgrading the app to Xcode 5 and running in the IOS7 simulator, I noticed that some buttons on the right side of the screen were not fully active. ie only a fraction of the left side of the button was clickable.

Observation: Running the same source code in IOS6 and IOS7 simulators, and viewing the view hierarchy using the REVEAL tool, I can see that the dimensions of the UIViewControllerWrapperView (the parent of my top level view controller) are landscape for IOS6 (1024x768), but portrait for IOS7.

I am trying to find a way to set the frame of the UIViewControllerWrapperView to the correct dimensions. In the view controller's viewDidLoad method, I tried to get a reference to self.view.superview, but it returns nil.

Can anybody explain; a) why the UIViewControllerWrapperView's frame is in the wrong orientation when running in IOS7 and not IOS6, and more importantly b) how to make it right?


Are you using a UITabBarController? We were having exactly the same issue and got it working by adding this on the UITabBarController:

- (void)viewDidLayoutSubviews
{
    // fix for iOS7 bug in UITabBarController
    self.selectedViewController.view.superview.frame = self.view.bounds;
}

Why? check this answer

链接地址: http://www.djcxy.com/p/90332.html

上一篇: viewview在iOS7中不再能够隐藏键盘

下一篇: 如何调整UIViewControllerWrapperView(在IOS7中)的方向?