views:

963

answers:

3

I have an iPhone app which was built using a standard UITabBarController. This app was created using the standard XCode project template.

Now, I have a requirement to change the UITabBar to look very different. The approach I decided to take was like this:

in my AppDelegate:

for (UIView *view in tabBarController.view.subviews) {  
    if([view isKindOfClass:[UITabBar class]]) {
        view.hidden = YES;
        break;
    }
}

This works to make the tab bar hidden. Next, I subclassed UITabBarController and I add a UIToolbar with a few custom components. In my subclassed UITabBarController I have my code set up so that when one of my custom objects is selected, the code simply calls [self setSelectedIndex:n] to update the UI.

So I basically have a UITabBarController but I am controlling it through a new UI.

The problem is that my new components aren't quite as tall as the normal UITabBar and the UITabBarController seems to be not resizing my views automatically. I actually would expect this behavior, but I can't figure out how to change the "content frame" of a UITabBarController. Any ideas?

+1  A: 
  1. Check the autoresizingMask property.
  2. Are you expecting them to work as tab bars usually do by adding items to the viewControllers view?
David Sowsy
I'm not expecting them to work as tab bars only because I've added them to the viewController views. I want them to display, but I know I'll have to write the code to make it functional.
marcc
A: 

Resolved with the following code:

[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 436)];

(I know this code has issues btw and will come back to haunt me on the iPad or other devices).

marcc
A: 

i have the same problem where hiding the tabbar introduces a blank space. I tried resizing my webview frame's height but that didn't fix it. Which view are you setting the new frame? is it the tabbarcontroller or it's subview?

pkaur