Resize UINavigationController?

I want my navigation manager to occupy half the screen. Is it possible? In IB, when I drag, it makes me fill the whole screen, I can not resize it. If this is not possible, is there an alternative? Thank.

+3
source share
2 answers

You can, but you can do it only in iOS 5, because when I tried to do any manipulations with the direct view in the UINavigation controller, than pushed or pushed another view controller. The navigation controller does not display them.

Here is what you need to do.

-(void)viewDidLoad {
     UINavigationController * navController = [[UINavigationController alloc] initWithRootViewController:[[UIViewController alloc] initWithNibName:nil bundle:nil]];
     //Used to recieve callbacks (like shouldAutorotateToInterfaceOrientation:)
     [self addChildViewController:navController];
     //View manipulation
     navController.view.frame = CGRectInset(navController.view.frame, 20, 20);
     [self.view addSubview:navController.view];
     //Calls all the standard methods (viewDidLoad,viewDidUnload,etc.)
     [navController didMoveToParentViewController:self];
}

, , , WWDC.

+1

, , , @property . - :

@property (nonatomic, strong) IBOutlet UINavigationController *navController;

IBOutlet xib. xib , . , . navController . viewController, xib navController, viewDidLoad :

-(void)viewDidLoad {
     [self addChildViewController:self.navController];
     [self.view addSubview:self.navController.view];
     [self.navController didMoveToParentViewController:self];
}

, rootviewcontroller:

-(void)viewDidLoad {
      self.navController = [[UINavigationController alloc] initWithRootViewController:yourViewController];
      [self addChildViewController:self.navController];
      [self.view addSubview:self.navController.view];
      [self.navController didMoveToParentViewController:self];
}

self.navController childViewController, . . , !

0

All Articles