Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change a window orientation to landscape in XCode 4 Interface Builder?

Tags:

ios

xcode4

I appreciate I'm probably missing something basic here, but...

My iPad app will only support landscape mode, and has a MainWindow.xib Window that I'd like to work on in landscape mode in XCode 4, however the pull-down menu to change this (Simulated Metrics -> Orientation) is always grayed out.

I notice that Views can be rotated just fine, it's only Windows that can't be rotated in XCode 4 using this setting.

Is there a workaround for this, or do I have to put a View on top of the MainWindow in order to rotate it?

like image 971
Surfbutler Avatar asked May 27 '11 13:05

Surfbutler


1 Answers

I think it's because apps always starts up in portrait and then rotates to appropriate oriantations. From the UIViewController docs:

Note: At launch time, applications should always set up their interface in a portrait orientation. After the application:didFinishLaunchingWithOptions: method returns, the application uses the view controller rotation mechanism described above to rotate the views to the appropriate orientation prior to showing the window.

So you'll need the UIViewController magic for the simulated metrics to make any sense. If you used the "Window-based application" template as a starting point for your project try the "View-based application" template instead.

like image 121
Stefan Avatar answered Sep 28 '22 08:09

Stefan