views:

29

answers:

1

I got the code from this question: http://stackoverflow.com/questions/2257178/how-to-hide-tab-bar-controller-programmatically which is brilliant, however the view doesn't expand to fit the space left by the tab bar now.

I have set the appropriate UIViewAutoresizingMasks to the view, but I'm assuming that just because its hidden doesn't mean its not still taking up the space?

Anyway, if I do [self.navigationController setNavigationBarHidden:YES animated:YES]; then the navigation bar moves up and off the screen expanding the view with it.

How can I replicate this behavior for the Tab Bar?

Thank you

Tom

A: 

The easiest way is probably to set a new frame for the view:

CGRect viewFrame = view.frame;
viewFrame.size.height += 40; // Change this to the height of the tab bar
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.75];

view.frame = viewFrame;

[UIView commitAnimations];
loomer
hmm... that didn't seem to work. :(
Thomas Clayson
ok, what was the problem?
loomer
Theres just a white space at the bottom where the tab bar used to be. `self.view` has a background picture that doesn't move down and fill in where the tab bar used to be.
Thomas Clayson
Ok. Which view is you trying to set a new frame on? It probably doesn't work to change the frame of the view controller view, you need to add a subview. If you can post some code it would make it easier to answer your question.
loomer