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

六月ゝ 毕业季﹏ 提交于 2019-12-19 03:10:22

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/6153271/how-can-i-change-a-window-orientation-to-landscape-in-xcode-4-interface-builder

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!