我已经在我的应用程序中实现了 UITabBarController。它的代码如下:
MainCollection *mainView = [[MainCollection alloc] initWithNibName:@"MainCollection" bundle:nil];
UINavigationController *mainNav = [[UINavigationController alloc] initWithRootViewController:mainView];
mainView = (MainCollection *)mainNav.topViewController;
mainView.managedObjectContext = self.managedObjectContext;
ShowFavourites *showVC = [[ShowFavourites alloc] initWithNibName:@"ShowFavourites" bundle:nil];
UINavigationController *showNav = [[UINavigationController alloc] initWithRootViewController:showVC];
showNav.title=@"Favourites";
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UITabBarController *tabBar = [[UITabBarController alloc] init];
[tabBar setViewControllers:@[mainNav,showNav]];
[self.window setRootViewController:tabBar];
[self.window makeKeyAndVisible];
return YES;
我的第一个屏幕是MainCollection我应该在这个视图中显示 tabBar。假设下一个视图是SubCategory但是当我导航到 SubCategory 时,在这个视图上我想隐藏 Tabbar 那么如何隐藏它或仅从 SubCategory 视图中删除它?
任何的想法?
提前致谢。