views:

713

answers:

1

I want to make the top of the navigation view a bit smaller. How would you achieve this? This is what I've tried so far, but as you can see, even though I make the navigationbar smaller, the area which it used to occupy is still there (black).

[window addSubview:[navigationController view]];
navigationController.view.frame = CGRectMake(0, 100, 320, 280);
navigationController.navigationBar.frame = CGRectMake(0, 0, 320, 20);
navigationController.view.backgroundColor = [UIColor blackColor];
[window makeKeyAndVisible];

alt text

+1  A: 

If you want to use a custom height for your nav bar, I think you should probably, at the very least, use a custom nav bar (not one in your nav controller). Hide the navController's bar and add your own. Then you can set its height to be whatever you want.

Ben Gottlieb
Setting the height wasn't the problem, more that the other things, in this case the content (tableview) doesn't seem to adjust its position when the navbar changes its size. How's adding my custom navbar going to affect the content?
quano
the view hierarchy of a NavController-with-navBar is a bit complex. There's a parent view, a navBar, and then content stored in your view controller's view. If you resize the nav bar, it doesn't necessarily resize your controller's view. If YOU resize stuff, you can better control what gets re-flowed to fit.
Ben Gottlieb