How can I change a window orientation to landscape

2020-03-03 06:00发布

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?

标签: ios xcode4
1条回答
够拽才男人
2楼-- · 2020-03-03 06:21

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.

查看更多
登录 后发表回答