这是我的代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
CSDisplayPlaza *displayPlaza = [[CSDisplayPlaza alloc] initWithNibName:@"CSDisplayPlaza" bundle:nil];
[displayPlaza setTabBarItem:[[UITabBarItem alloc] initWithTitle:@"one" image:[UIImage imageNamed:@"displayPlaza"] tag:0]];
UINavigationController *displayPlazaNav = [[UINavigationController alloc] initWithRootViewController:displayPlaza];
CSGameHall *gameHall = [[CSGameHall alloc] initWithNibName:@"CSGameHall" bundle:nil];
[gameHall setTabBarItem:[[UITabBarItem alloc] initWithTitle:@"two" image:[UIImage imageNamed:@"displayPlaza"] tag:1]];
UINavigationController *gameHallNav = [[UINavigationController alloc] initWithRootViewController:gameHall];
CSMyInformation *myInformation = [[CSMyInformation alloc] initWithNibName:@"CSMyInformation" bundle:nil];
[myInformation setTabBarItem:[[UITabBarItem alloc] initWithTitle:@"three" image:[UIImage imageNamed:@"myInformation"] tag:2]];
UINavigationController *myInformationNav = [[UINavigationController alloc] initWithRootViewController:myInformation];
self.tabBarController = [[UITabBarController alloc] init];
[tabBarController setViewControllers:[NSArray arrayWithObjects:displayPlazaNav,gameHallNav,myInformationNav,nil]];
[tabBarController setSelectedViewController:displayPlazaNav];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
在模拟器中,无法显示任何视图控制器。在我的模拟器中只是一个空的标签栏。我不知道会发生什么。