我有在 iOS 5 上运行良好的 iPad 应用程序。我的应用程序根视图控制器实现了 UITabBarDelegate 和 UINavigationControllerDelegate。但在 iOS 6 上,我只能看到一次 tabBar - 第一次运行。在第二。第三个等运行 tabBar 消失。那么WFT?%-)
这是我的 AppDelegate 的 applicationDidFinishLaunching:application:
- (void)applicationDidFinishLaunching:(UIApplication*)application
{
...
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
CGRect mainViewFrame = _window.frame;
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
mainViewFrame.origin.y = CGRectGetHeight(statusBarFrame);
mainViewFrame.size.height -= CGRectGetHeight(statusBarFrame);
[self padMainController].view.frame = mainViewFrame;
[_window setRootViewController:[self padMainController]];
}
...
}
这是 padMainController 标头的片段:
@interface LTPadMainController : LTAutorotateController <UINavigationControllerDelegate, UITabBarDelegate>
以及 LTAutorotateController 的片段:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad && UIDeviceOrientationIsLandscape(interfaceOrientation)) || (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && UIDeviceOrientationIsPortrait(interfaceOrientation)));
}
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}