读书人

导航栏与标签栏依存的实现

发布时间: 2012-09-24 13:49:41 作者: rapoo

导航栏与标签栏并存的实现

?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    FirstViewController *mainViewController = [[FirstViewController alloc] init];SecondViewController *searchViewController = [[SecondViewController alloc] init];mainViewController.title = @"首页";searchViewController.title = @"搜索";UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:mainViewController];UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController:searchViewController];[mainViewController release];[searchViewController release];NSMutableArray *controllers = [[NSMutableArray alloc] init];[controllers addObject:nav];[controllers addObject:nav1];[nav release];[nav1 release];tabBarController.viewControllers = controllers;tabBarController.selectedIndex = 0;[self.window addSubview:tabBarController.view];[self.window makeKeyAndVisible];    [controllers release];return YES;}

读书人网 >移动开发

热点推荐