3

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?

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
Hyperbole
  • 3,917
  • 4
  • 35
  • 54

2 Answers2

2

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

In code, it's

[myNavController.view setAutoresizesSubviews: NO];
Olie
  • 24,597
  • 18
  • 99
  • 131
0

I'd try

myNavController.superview.autoresizesSubviews = NO

and obviously check myNavController.autoresizingMask

As a last resort, subclass its superview and reimplement layoutSubviews

EdChum
  • 376,765
  • 198
  • 813
  • 562
Yann Bizeul
  • 403
  • 3
  • 10