此项目的标签栏未显示,而只是显示黑屏。此标签栏在app delegate中的应用程序启动时以实用方式输入。
main_tab=[[UITabBarController alloc]init];
viewcontroller = [[HomeViewController alloc]init];
viewcontroller.title =@"Home";
UINavigationController *nav =[[UINavigationController alloc]initWithRootViewController:viewcontroller];
viewcontroller1 = [[SearchViewController alloc]init];
viewcontroller1.title =@"Search";
UINavigationController *nav1 =[[UINavigationController alloc]initWithRootViewController:viewcontroller1];
tabs_array=[[NSArray alloc]initWithObjects:nav,nav1, nil];
main_tab.viewControllers=tabs_array;
[self.window addSubview:main_tab.view];
[self.window makeKeyAndVisible];
return YES;
答案 0 :(得分:2)
尝试替换此行
[self.window addSubview:main_tab.view];
有了这个
self.window.rootViewController = main_tab;