TJ15
TJ15

Reputation: 363

Auto rotate function in Xcode (ipad)

I need you help with the auto rotate function in Xcode. I have designed an iPad app in landscape and due to restriction it must always be in landscape (left home button). In the .plist I have set the supported interface orientations to only landscape (left home button) and when I run this in the simulator it opens correctly. If I rotate this left or right I would expect the view to rotate with the simulator but this is not the case. My understanding is that by default auto rotate is disabled. Has anyone had a similar issue or know how to stop this rotating?

Thanks for your help.

Upvotes: 1

Views: 4393

Answers (1)

Dennis Bliefernicht
Dennis Bliefernicht

Reputation: 5157

In the .plist file you only specify your startup orientations. After that every view controller can implement shouldAutorotateToInterfaceOrientation: in which the view controller is "asked" if a rotation to another orientation is acceptable. In the standard template for iPad apps this always returns YES and thus allows all orientations. In your case you might only return YES when the given orientation is UIInterfaceOrientationLandscapeLeft, although you should have a look if you can support both landscape orientations as Apple human interface guidelines strongly suggest to at least support both landscape orientations if one is supported.

Note that every view controller in your app has to specify its own orientations as it may make sense to have some views more restricted than others.

For further information on this have a look at:

Upvotes: 2

Related Questions