我试图提出一个模态的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