views:

536

answers:

2

Developing an iPad interface, I have a scenario where I have a UIViewController which manages a view that gets placed directly as a subview of the main UIWindow.

Before being placed in the UIWindow, that view gets resized to a non-standard size, let's say, 768x460, and positioned at the bottom of the screen.

When rotating the device, the autoRotate feature of the UIViewController causes the view to be resized so that it fills the entire UIWindow space.

I thought this might be because in the XIB, the view is set to window size, but when I changed it to reflect the desired size, it still expanded it to the window size.

Then I went into the MainWindow XIB and turned off autoresizeSubviews, and it still happens.

This is a very frustrating problem, I am hoping that there is merely something obvious that I am missing out on.

Anyone have any bright ideas?

Code by request:

browseController = [[BrowseController alloc] initWithNibName:@"BrowseController" bundle:nil];

[[browseController view] setFrame:CGRectMake(0, 544, 768, 460)];

[window addSubview:[browseController view]];
A: 

What about springs and struts? (aka autoresizingMask) See here. In code you might need the extra line

[[browseController view] setAutoresizingMask:UIViewAutoresizingNone];
Jared P
+1  A: 

IF you are in interface builder, click on the size tab when you are editing the view. Under "autosizing" click on all the red arrows so that they disappear. You do not want any red arrows there. Or in code you can do the following:

browseController.autoresizingMask = UIViewAutoresizingNone;
rickharrison