6

I recently upgraded to Xcode 4. Previously in Xcode 3 to set the allowed device orientations you had to edit the shouldAutorotateToInterfaceOrientation: method in the application delegate. But now in Xcode 4 I see there is an option in Targets -> Summary where you can select different orientations.

Which alternative will rule over the other?

Cheers,

Peter

Peter Warbo
  • 11,136
  • 14
  • 98
  • 193

2 Answers2

9

Your memory is slightly faulty; shouldAutorotateToInterfaceOrientation: is in custom subclasses of UIViewController. So it allows each view controller to say which orientations it works in individually. So you can have an app that overwhelmingly works in portrait or landscape, but has a view view controllers that only work in portrait, for example — which is useful if you're incorporating off-the-shelf code.

The supported device orientations in targets -> summary go into your Info.plist, to provide metadata to the OS without it having to launch your app.

Ideally the two should agree, and I don't think either one overrides the other. The summary information should summarise all of your various view controllers, but I'd be surprised if you got anything other than the odd weird launch behaviour if you fill it in incorrectly.

Tommy
  • 99,986
  • 12
  • 185
  • 204
  • 3
    The stuff in Info.plist affects how the app will appear when the OS launches it and displays the startup image. After that, the controllers' `shouldAutorotateToInterfaceOrientation:` methods control everything. – Kristopher Johnson May 17 '11 at 12:37
1

The "target summary" is just short hand for the data in the Info.plist file and so this has been available before. Nothing new here.

Eiko
  • 25,601
  • 15
  • 56
  • 71