views:

266

answers:

2

Hi,

I have created a application with UINavigationController and it is appearing fine now i want to make the size of the NavigationController to a smaller size. How can i do it?

A: 

You can't.

According to the UINavigationController documentation, the only options you have to change the look are the barStyle and the translucent properties;

With only a few exceptions, you should never modify the navigation bar object directly. It is permissible to modify the barStyle or translucent properties of the navigation bar but you must never change its frame, bounds, or alpha values directly. In addition, the navigation controller object builds the contents of the navigation bar dynamically using the navigation items (instances of the UINavigationItem class) associated with the view controllers on the navigation stack. To change the contents of the navigation bar, you must therefore configure the navigation items for your custom view controllers. For more information about navigation items, see UINavigationItem Class Reference.

Laurent Etiemble
Thanks for the reply. I also have a UITabbarController, can i resize that atleast. If so how to do it?
Cathy
UITabbarController follows the same restrictions. Unless you create a custom bar controller, you can only specify the tint or the translucency of these two controls. It is mainly for UI consistency reasons.
Laurent Etiemble
You shouldn't be trying to modify standardized interface elements. Doing so will only confuse the user. Shrinking an element makes it harder to use. I can barely hit some UI elements as it is. If you think you need to reduce the size of UI elements, your UI design is most likely overcrowded and you need to move some functionality to another view.
TechZen
Ok, I down-voted and changed my mind, but it's locked. Sorry.
bentford
A: 

IMPORTANT: this idea sounded great in and seemed to work in theory, but the iAd framework doesn't allow you to add an AdBannerView directly to the UIWindow. <<<<<

You can resize a UINavigationController but you cannot move the top or bottom ToolBar.

Here is an example of making a AdBanner go below your UINavigationController but above it's bottom toolbar. This AdBanner will remain stationary in your view--it will not animated with UIViewController push and pop actions.

1) Resize your UINavigationController in the app delegate:

navigationController.view.frame = CGRectMake(0, 0, 320, 410);

2) Manually resize the ViewControllers to add a gap below. A good place to do this is in viewDidLoad method:

self.view.frame = CGRectMake(0, 0, 320, 322);

3) Add your AdBannerView directly to the application's window (remember it is just another UIView). So the AdBanner would go above the toolbar, but below any visible view controllers.

[window addSubview:addBannerView];

It looks something like this:

alt text

bentford