如何在XCode 4接口构建器中将窗口定向更改为横向?

时间:2022-06-02 21:08:42

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.

我的iPad应用只支持横向模式,并且有一个主窗口。我想在XCode 4中以横向模式处理的xib窗口,但是要更改这个(模拟度量->方向)的下拉菜单总是灰色的。

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

我注意到视图可以很好地旋转,只有Windows不能使用这个设置在XCode 4中旋转。

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 个解决方案

#1


2  

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

我认为这是因为应用程序总是从竖屏开始,然后旋转到合适的方向。从ui文档:

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.

注意:在启动时,应用程序应该始终将其接口设置为纵向。在应用程序:didFinishLaunchingWithOptions: method返回后,应用程序使用上面描述的视图控制器旋转机制,在显示窗口之前将视图旋转到适当的方向。

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.

所以你需要UIViewController魔术让模拟的指标有意义。如果您使用“基于窗口的应用程序”模板作为项目的起点,那么请尝试“基于视图的应用程序”模板。

#1


2  

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

我认为这是因为应用程序总是从竖屏开始,然后旋转到合适的方向。从ui文档:

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.

注意:在启动时,应用程序应该始终将其接口设置为纵向。在应用程序:didFinishLaunchingWithOptions: method返回后,应用程序使用上面描述的视图控制器旋转机制,在显示窗口之前将视图旋转到适当的方向。

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.

所以你需要UIViewController魔术让模拟的指标有意义。如果您使用“基于窗口的应用程序”模板作为项目的起点,那么请尝试“基于视图的应用程序”模板。