在iOS 5及6我在viewWillAppear中的方法在我的视图控制器这样做:力横向
UIViewController *c = [[UIViewController alloc] init];
//To avoid the warning complaining about the view not being part of the window hierarchy
[[[TWNavigationManager shared] window] addSubview:c.view];
[self presentModalViewController:c animated:NO];
[self dismissModalViewControllerAnimated:NO];
[c.view removeFromSuperview];
我也是在应用程序委托添加了这个方法
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return [[TWNavigationManager shared] supportedInterfaceOrientationsForTopViewController];
}
基本上将该调用转发给顶视图控制器。
这导致我的视图控制器被调用自动旋转方法,然后我能够强制只是该视图控制器的横向方向。 现在在iOS 7中,代码无法工作了。白色视图全屏显示。
什么是iOS7的正确方法?
在此先感谢。
你从哪里提出这个lanscape-only-viewController?它是导航堆栈中的“推”还是模态地呈现的视图控制器?在这种情况下,它更容易) – Vinzzz
是的,这是一个推动导航堆栈。我的根视图控制器是一个UITabBarViewController,每个项目都有一个UINavigationController。 – mdonati