Tag Archives: orientation

Handling rotations in UIViewController

In this post I’ll give a few general tips for handling device rotations at the UIViewController level. ¬†These tips are for code using iOS (formerly known as iPhone OS) 3.0 or later, which includes all iPad code. 1. ¬†In¬†willAnimateRotationToInterfaceOrientation:duration:, size and position the view for the new orientation. This sounds obvious and easy, but there […]

Detecting orientation

I was surprised to learn today that [[UIDevice currentDevice] orientation] doesn’t always give the correct orientation. In fact, it seems to consistently fail whenever it’s called early in the app launching process. What’s up with that? What’s going wrong If you command-double click on UIDeviceOrientation, you’ll see that this type is an enum defined in […]