我有一个包含 UITabBarController 的 UINavigationController 的根视图。标签栏控制器有两个简单的视图。当它首次在 iOS 6 模拟器或设备上启动时,第一个视图上方会出现一个间隙。切换到第二个选项卡并返回会导致间隙消失。这只是从 iOS 6 开始发生。iOS 5 工作得很好。任何想法发生了什么变化?
截屏:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UITabBarController *tabBarController = [[UITabBarController alloc] init];
UIView *dummyView1 = [[UIView alloc] init];
[dummyView1 setBackgroundColor:[UIColor redColor]];
UIViewController *dummyViewController1 = [[UIViewController alloc] init];
[dummyViewController1 setView:dummyView1];
UIView *dummyView2 = [[UIView alloc] init];
[dummyView2 setBackgroundColor:[UIColor blueColor]];
UIViewController *dummyViewController2 = [[UIViewController alloc] init];
[dummyViewController2 setView:dummyView2];
NSArray *viewControllers = [NSArray arrayWithObjects:dummyViewController1, dummyViewController2, nil];
[tabBarController setViewControllers:viewControllers];
UINavigationController *rootNavController = [[UINavigationController alloc] initWithRootViewController:tabBarController];
[[self window] setRootViewController:rootNavController];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}