Question

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?

Was it helpful?

Solution

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

In code, it's

[myNavController.view setAutoresizesSubviews: NO];

OTHER TIPS

I'd try

myNavController.superview.autoresizesSubviews = NO

and obviously check myNavController.autoresizingMask

As a last resort, subclass its superview and reimplement layoutSubviews

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top