I have a UIViewController which supports all interface Orientations. The views are created programatically in the loadView() which works so far. All the views added in the loadView() method have the correct size and rotation.
However any views added later on are not rotated correctly. If I add the following UIView
[[[UIView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] applicationFrame].size.width, [[UIScreen mainScreen] applicationFrame].size.height)] autorelease];
it is only fullscreen if the UIViewController was in portrait mode when the UIView was added. If the device was in landscape mode the UIView is only 748 pixels wide, not the 1024 I would expect. [[UIScreen mainScreen] applicationFrame].size.width delivers 768 pixels or 748 pixels depending on the device's rotation.
So how should I create and add the UIView so it is shown with the full screen size? I would also like to init the UIView's content only for one mode (portrait OR landscape) and have it autoresized for the other mode. I basically need to tell the UIView it is a portrait mode view and should be rotated when added to a landscape view controller.