質問

I want to use UITabBarController but I do not need a tab bar because I'm going to switch tabs from the menu in another view controller. I want to remove it as it will be never used. I've created a subclass of UITabBarController and put this code:

- (void)viewDidLoad
{
    [super viewDidLoad];

    [self.tabBar removeFromSuperview];
}

Is that safe to remove tab bar that way?

Update: Why tab bar controller?

Apple suggests to use standard container view controllers whenever it possible. I'm trying to follow that. My screens workflow is the same as for tabs, except that they are switched by left side menu, not by the tab bar.

When I use a UIViewController and change it's child view controller I've got a lot of problems when autolayouts are not working properly.

The other reason is that I want to use story board, rather then create segues from the code so I can see my app workflow easily.

役に立ちましたか?

解決

When you are saying, you don't want to use it, then why to remove it. You can go with a tabbarcontroller with hidden tabbar. I am switching tabs from the bottom custom bar.

I am doing an app, which has a tababr controller with three items. Instead of using system tab, I am creating a custom view at the footer like tab & have actually set the hidden property of tabbarController's tabbar to YES.

myTabBarController.tabBar.hidden = YES;

他のヒント

Try this code

[app.navigationController.view removeFromSuperview];
[app.tabbarcontroller.view removeFromSuperview];
[app.window addSubview:app.navigationController.view];
[app.navigationController popToRootViewControllerAnimated:YES];
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top