【发布时间】:2013-02-27 01:17:10
【问题描述】:
我有一个支持所有四个方向的应用程序,它在 iOS 5 上运行良好。
但是,在 iOS 6 上,我的所有 UIViewController 类都可以正确旋转,但我的 UITableViewController 类不能旋转到 PortraitUpsideDown 。
应用支持的方向包括所有四个选项。
AppDelegate 支持所有方向:
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
//return (UIInterfaceOrientationMaskAll);
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown);
}
我的所有视图类都实现了必要的方法,包括为 iOS 6 引入的方法:
- (NSUInteger)supportedInterfaceOrientations
{
//return (UIInterfaceOrientationMaskAll);
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown);
}
- (BOOL)shouldAutorotate
{
BOOL bReturn = [self shouldAutorotateToInterfaceOrientation:self.interfaceOrientation];
return (bReturn);
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (YES);
}
我能找到的唯一区别是视图的显示方式。
UIViewController
InfoViewController *infoController = [[InfoViewController alloc] initWithNibName:@"InfoViewController" bundle:[NSBundle mainBundle]];
[self presentModalViewController:infoController animated:YES];
UITableViewController
MenuViewController *menuController = [[MenuViewController alloc] initWithNibName:@"MenuViewController" bundle:[NSBundle mainBundle]];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:menuController];
[self presentModalViewController:navigationController animated:YES];
不完全确定实施会对轮换产生什么影响,更不确定该怎么做。
任何指导将不胜感激。
【问题讨论】:
-
嗯,我刚刚想到我正在呈现一个 UINavigationController,而不是我的 MenuViewController 对象。不确定这是否是实际问题,或者如何将支持的方向与 UINavigationController 对象相关联。
标签: ios ios6 uitableview uiinterfaceorientation