我不确定我是否正确解决了您的问题..但是如果您的意思是“向下钻取表格视图”以更深入地了解导航控制器层次结构,您可以尝试以下操作..
这就是我在(我认为)类似情况下所做的:
应用委托:
在.h中:
@property (nonatomic) BOOL shouldAutorotate;
以 .m 为单位:
// 在 didFinishLaunchingWithOptions 中:
self.shouldAutorotate = NO;
// 仍然在 .m 文件中
// Autorotation handling
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return self.shouldAutorotate ?
UIInterfaceOrientationMaskAllButUpsideDown :
UIInterfaceOrientationMaskPortrait;
}
显示纵向控制器的导航控制器
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (NSUInteger)supportedInterfaceOrientations
{
if (self.selectedViewController)
return [self.selectedViewController supportedInterfaceOrientations];
return UIInterfaceOrientationMaskPortrait;
}
- (BOOL)shouldAutorotate
{
return YES;
}
Portrait View Controller(这也是您拥有的非常相似的 segue 处理):
在视图中会出现:
[(AppDelegate *)[[UIApplication sharedApplication] delegate] setShouldAutorotate:YES];
旋转处理:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (BOOL)shouldAutorotate
{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
横向视图控制器(可能是您的全屏图像):
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
在导航控制器层次结构的更深处(只需要纵向):
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (BOOL)shouldAutorotate
{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
看起来有点复杂,但这是唯一的方法,我设法让这些旋转的东西在 iOS5 和 6 中都能正常工作。