开发者

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

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开发者_StackOverflow中文版 have to put a View on top of the MainWindow in order to rotate it?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜