Search code examples
iosuiviewcontrollersubviewuiwindow

What causes a UIView subview to take fullscreen?


I have a project which loads a UIViewController aka appViewController to the UIWindow full screen. I then am adding another UIViewController aka menuViewController to the UIWindow. The menuViewController has a xib with a UIView with dimensions of 480 x 35. I add the menuViewController to the UIWindow like this:

MenuViewController *tempController = [[MenuViewController alloc] initWithNibName:kMenuViewController bundle:nil];

self.menuViewController = tempController;
[tempController release];

menuViewController.view.center = CGPointMake(17, 240);

[window insertSubview:menuViewController.view aboveSubview:appViewController.view];

The problem is that menuViewController is NOT respecting my center call and actually taking on fullscreen and covering my appViewController.

In Interface Builder I saw a property called: Autoresize Subviews checked for the UIWindow. I tried unchecking this and even for the subview and still does not work.

NOTES:
This project was updated from (which worked perfectly fine):

Built with: Xcode 3.x.x (forgot exact)

Base iOS: 3.0

Target iOS: 2.2

And updated to:

Built with: Xcode 4.3.1

Base iOS: Latest (5.1)

Target iOS: 4.2

Thanks!


Solution

  • I found that by editing the size of the view controller a few seconds after it was loaded, the problem was fixed.