我不確定我的問題是否正確..但是如果您的意思是「鑽取表格視圖」以便在導航控制器層次結構中進行更深層次的設置,則可以嘗試以下操作..
這就是我的(我認爲)類似的情況做了:
的AppDelegate:
在.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;
}
縱向視圖控制器(在這裏也是一個非常相似你有的處理):
在viewWillAppear中:
[(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都能正常工作。
我認爲你理解的很好!但我不明白這是什麼代碼行的意思是:[(AppDelegate *)[[UIApplication sharedApplication] delegate] setShouldAutorotate:YES]; –
這會將AppDelegate中的「shouldAutorotate」屬性設置爲「YES」。所以這應該激活自動旋轉一個縱向控制器的地方控制器的地方。 – d4Rk
當我將這行代碼放在我的項目中時,它告訴我「使用未聲明的標識符:AppDelegate」,我錯過了什麼?我很抱歉打擾你,但我仍然是一個菜鳥編程。 –