I have never checked this myself on universal applications, however make sure that:
The window is already part of the view hierarchy. A newly created window won't help you with determining the size (you say you log
frame
"at the very beginning of -applicationDidFinishLaunching:").The
frame
is just an accessor which mergesbounds
andcenter
properties. It doesn't work correctly if transforms are applied to the view (window). However, with a window, it's typical that a transform is applied.
The iOS drawing code for a window looks similar to the following:
CGContextSaveGState(context);
CGContextTranslateCTM(context, [window center].x, [window center].y);
CGContextConcatCTM(context, [window transform]);
CGContextTranslateCTM(context,
-[window bounds].size.width * [[window layer] anchorPoint].x,
-[window bounds].size.height * [[window layer] anchorPoint].y);
[[window layer] renderInContext:context];
CGContextRestoreGState(context);
(See Technical Note QA1703)
You can see that the final frame
size is determined from bounds
and transform
. If you do some experiments, you can see that, for example, the keyboard window never changes bounds, even when device orientation is changed. The size change between portrait and landscape orientations is determined by the transform
.
In general, window.rootViewController.bounds
is the way to go.