所以我有一个连接到IBAction的按钮.当我按下按钮时,我想用动画隐藏iOS应用程序中的标签栏.这个[self setTabBarHidden:hidden animated:NO]; 或这个[self.tabBarController setTabBarHidden:hidden animated:YES];不起作用.这是没有动画的代码:
- (IBAction)picture1:(id)sender {
[self.tabBarController.tabBar setHidden:YES];
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激:D
我有一个导航控制器.对于其中一个视图,我想隐藏底部标签栏,以便获得最大可能的屏幕空间.要做到这一点,我有:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.hidesBottomBarWhenPushed = YES; // To hide the tab bar
}
return self;
}
Run Code Online (Sandbox Code Playgroud)
但是对于我推动堆栈的下一个视图,我希望标签栏重新出现.有没有办法做到这一点?
我在我的应用程序中实现了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;
Run Code Online (Sandbox Code Playgroud)
我的第一个屏幕是MainCollection我应该在此视图中显示tabBar.假设在未来的看法是子类别,但是,当我浏览到其他子类别,这种观点我想隐藏的TabBar然后我如何可以将其隐藏或仅删除其子类别的看法?
任何的想法?
提前致谢.