我試圖提出一個模態的UITabBarController使用下面的代碼:呈現的UITabBarController模態 - 自動旋轉問題
// Declare all view controllers.
TabOne *tabOne = [[TabOne alloc] initWithNibName:@"TabOne" bundle:nil];
TabTwo *tabTwo = [[TabTwo alloc] init];
TabThree *tabThree = [[TabThree alloc] init];
// Set each view controller's delegate to self.
tabOne.delegate = self;
tabTwo.delegate = self;
tabThree.delegate = self;
// Set a title for each view controller.
tabOne.title = @"One";
tabTwo.title = @"Two";
tabThree.title = @"Three";
// Create a tab bar controller.
UITabBarController *tabBarController = [[UITabBarController alloc] init];
[tabBarController setViewControllers:[NSArray arrayWithObjects:tabOne,tabTwo,tabThree, nil]];
// Present the tab bar controller modally.
[self presentModalViewController:tabBarController animated:NO];
// Memory management.
[tabOne release];
[tabTwo release];
[tabThree release];
這種預期只是我在控制檯中下列警告所有作品:
使用兩段旋轉動畫。要使用更平滑的單級動畫,此應用程序必須移除兩階段方法實現。 旋轉多個視圖控制器或視圖控制器而不是窗口委託時,不支持使用兩級旋轉動畫。
我做了一些研究這一點,並檢查了shouldAutorotateToInterfaceOrientation執行如下:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
據我所知道的,問題是標籤欄控制器不是根視圖控制器,但我將這種模式視圖以某種方式呈現在深層視圖層次結構中。它是從另一個模式視圖調用的,該視圖本身是從應用程序委託中設置的選項卡中調用的。
我知道這是一個古老的板栗,但它讓我難倒了。有什麼想法嗎?
在此先感謝。
你應該檢查Ax Monkey的正確答案。 – Alexander 2012-07-02 10:20:47