yibuyiqu
yibuyiqu

Reputation: 718

hide custom tabbar when push

I have a customized tabbar in my app. I want to hide my tabbar when pushing another viewcontroller. Currently I implemented as this(The original tabbar has been hidden):

myViewController.hidesBottomBarWhenPushed = YES;
((CustomTabBarController *)self.tabBarController).customTabBar.hidden = YES;
[self.navigationController pushViewController:lookBookViewController animated:YES];

But when it is being pushed, it hides my customTabBar immediately. So you can see a black bottom bar in first viewcontroller. Is there a way to fix this problem?

Thanks.

Upvotes: 1

Views: 1764

Answers (1)

Guo Luchuan
Guo Luchuan

Reputation: 4731

put your these code in - (void)viewDidDisappear:(BOOL)animated;

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
    myViewController.hidesBottomBarWhenPushed = YES;
    ((CustomTabBarController *)self.tabBarController).customTabBar.hidden = YES;
}

you can design like this enter image description here

and then you need not to hide the tabbar , if you want to hide it , you can use my above code , I think if you design like this , the hide effect will be you want

Upvotes: 1

Related Questions