“Incorrect” frame / window size after re-orientation in iPhone

The orientation of your device changed, not the physical characteristics of the screen. You basically tipped it on its side, but in reality it is 320 pixels wide (20 of which are not available to you at the moment since the status bar is showing) and 480 pixels tall. If your view is auto-rotating, then the width/height have been translated for you, but when you ask for the actual dimensions of the screen, you get back the actual dimensions of the screen.

This is also why, when working with translated views, it is important to do calculations based on the view’s center and the view’s bounds and never on the view’s frame.

Leave a Comment