Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UINavigationController autoresizing views behavior

I've read in Apple's documentation about UINavigationController's resizing behavior and it hasn't been much of a problem until now.

I have the following code to set up my UINavigationController's view:

navController.view.frame = CGRectMake(0, 40, 320, 420);

and this is sufficient until the view is obscured by a modal view, at which point the view is resized to the default size somewhere between calls of viewWillAppear and viewDidAppear (as UINavigationController inherits from UIViewController).

I'm attempting to keep a banner visible above the UINavigationController (in the 40 by 320 space left available) but this banner is consistently obscured as described above.

Is there a way to surpress UINavigationController's resizing behavior without subclassing UIViewController myself?

like image 668
Hyperbole Avatar asked Dec 20 '25 00:12

Hyperbole


1 Answers

In interface builder, you can uncheck the auto-resize checkbox.

In code, it's

[myNavController.view setAutoresizesSubviews: NO];
like image 194
Olie Avatar answered Dec 22 '25 15:12

Olie