`
jsntghf
  • 浏览: 2476230 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

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

    博客分类:
  • iOS
阅读更多

 

- (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;
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics