Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
546 views
in Technique[技术] by (71.8m points)

iphone - Setting hidesBottomBarWhenPushed leaves bottom bar missing after View Controller is popped

I have the following setup:

A tab bar app. On one tab there is a navigation controller.

My workflow:

When I push a new viewController onto the navigation controller stack, I set the hidesBottomBarWhenPushed property.

This works great, the tab bar is "pushed" as the new view controller slides in place.

The problem:

When I pop this view controller and the root view controller is once again displayed, however, the tab bar is gone.

The navigation controller has grown to fill the space left by tab bar.

Is there a property I need to set to make the tab bar visible again?


What I have tried:

popping to the root view manually

setting (resetting) the hidesBottomBarWhenPushed for the root view

resizing the root view

resizing the view property of the navigation controller (just leaves a "white space" where the tab bat should be)

What "sorta" worked:

If I set the selected index of the tab bar controller to any other index, the tab bar appears. So I know it is still "around", but this does little to help me.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had this problem too. I was setting -hidesBottomBarWhenPushed on the wrong view controller.

Wrong (but seems to work until you pop):

self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:self.anotherViewController animated:animated];

Right:

self.anotherViewController.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:self.anotherViewController animated:animated];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...