How to support iPad 1 rotation in Xcode 5

I was very excited when an old iPad 1 was delivered to me today – in marvellous condition! It will allow me to test my apps against iOS 5.1.1.

I immediately noticed that all Xcode 5 templates no longer have the rotation code embedded – without which iPad 1 won’t auto rotate.

Here’s what you need to implement into your UIViewController sub classes to support auto rotation:

// support auto rotation in iOS 5
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
	return YES;

Note than when you’re using the Master/Detail Template or any Split View Controller app you need to implement the above method in BOTH view controllers. Don’t ask me why – I’m just the messenger.

If you have an app based on a tab bar controller which houses several other view controllers, it’s enough to add this statement once to the initial view controller to make rotation work on all other view controllers. So the view controller currently “in vision” needs to have the above statement added.

Leave a Reply