How to resize UINavigationController in iPhone?

I created an application with a UINavigationController and now it looks great, so I want to make the size of the NavigationController smaller. How can i do this?

+4
source share
3 answers

You can resize or move the UINavigatorController by adding code ...

- (void)viewDidLoad { [super viewDidLoad]; myview_view = [[[MyCustomView alloc] init]autorelease]; ControlNav = [[UINavigationController alloc] initWithRootViewController:myview_view]; // Init the UINavigatorController ControlNav.navigationBarHidden = YES; // Hide the navigation bar ControlNav.view.frame = CGRectMake(50, 50, 665, 370); // Move and resize the UINavigator Controller [self.view addSubview:ControlNav.view]; // Add subview } 

MyCustomView is a UIViewController;

+4
source

You can not.

According to the UINavigationController documentation, the only parameters you need to change are the barStyle and translucent properties;

With a few exceptions, you should never modify the navigation bar object directly. You can change the barStyle or translucent properties of the navigation bar, but you should never change its borders, borders, or alpha values. In addition, the navigation controller object constructs the navigation content dynamically using navigation items (instances of the UINavigationItem Class) with navigation stack view controllers. To change the contents of the navigation bar, you therefore need to configure the navigation elements for your custom view controllers. For more information about navigational elements, see the UINavigationItem class reference.

+2
source

IMPORTANT: this idea sounded great and seemed to work theoretically, but the iAd framework does not allow you to add AdBannerView directly to UIWindow. & L; <<<<

You can resize the UINavigationController, but you cannot move the top or bottom toolbar.

Here is an example of how to make AdBanner below your UINavigationController, but above its bottom toolbar. This AdBanner will remain motionless in your view - it will not be animated using the UIViewController push and pop actions.

1) Resize your UINavigationController in the application delegate:

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

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

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

3) Add your AdBannerView directly to the application window (remember that this is just another UIView). Thus, AdBanner will go beyond the toolbar, but below any visible controllers.

 [window addSubview:addBannerView]; 

It looks something like this:

alt text

0
source

Source: https://habr.com/ru/post/1309658/


All Articles