我正在创建一个应用程序,其中包含导航栏和选项卡栏的使用。对于App中的某些屏幕,我们不会显示选项卡栏。但是大多数应用程序的屏幕都显示了Tab栏。所以我的问题是,我应该从哪个选项开始创建我的项目?即使用单视图应用程序或基于选项卡的应用程序。此外,在应用程序的30页中,只有5-6页没有显示选项卡栏。除此之外,所有的屏幕都显示选项卡栏。
因此,请建议我一个有效和最有用的方式来开始我的项目。另外,如果我用单视图应用程序创建我的项目,那么我如何创建一个带有导航栏的选项卡栏,只使用xib。我不想用故事板。
另外,如果我以基于选项卡的方式启动应用程序,并隐藏不需要显示的页面的选项卡栏,会发生什么情况?
请有人推荐我。
发布于 2014-07-28 14:55:01
如果您需要一个Tab Bar Controller,那么应该将它添加为您的根视图,我建议从Tab Bar Controller开始,并将其嵌入到导航控制器中
编辑
如果您想首先加载viewCOntroller,那么您可能需要将其添加到您的应用程序委托中的窗口中
ViewController *vc=[[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:vc];
self.window.rootViewController = nav;
[self.window makeKeyAndVisible];现在,当您想要通过按钮显示您的tabBarCOntroller,然后在按钮IBAction中,只需执行此…
-(IBAction)按钮:(Id)发件人{
UIApplication *appdelegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];
ViewController *vc=[[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
tabBarController= [[tabBarController alloc]init];
[tabBarController setViewControllers:@["your viewControllers"]];
UINavigationController * navigationController = [[UINavigationController alloc] initWithRootViewController:tabBarController];
appdelegate.window.rootViewController = navigationController;
[appdelegate.window makeKeyAndVisible];}
https://stackoverflow.com/questions/24989716
复制相似问题