基于轮换更改XIB文件的最佳方法?

问题描述:

到目前为止,我的应用程序只是一个基于肖像的应用程序.但是,我将横向模式添加到新版本中,但是发现从纵向旋转到横向时,我的XIB文件看起来很震撼.显然,我需要制作每个XIB的横向版本,并使用一些代码根据发生的轮换在XIB启动时进行更改.我对吗?如果是这样,我从这里去哪里?有使用此代码的Apple示例应用程序吗?

My app has so far just been a portrait-based application. However, I am adding landscape mode to a new version, but have found that my XIB files look shocking when rotated from portrait to landscape. Apparently I need to make a landscape version of each XIB and use some code to change with XIB launches based on what rotation occurs. Am I right? If so, where do I go from here? Are there any Apple sample apps utilising this code?

仅供参考-我的XIB文件中仅包含文本.

FYI - My XIB files just have text in them.

谢谢.

如果您的视图很复杂,则自动调整大小可能效果不佳.如果是这样,您最好的选择是从每个方向的不同笔尖加载不同的视图.

If you have a complex view, the automatic resizing may not work well enough. If so, your best bet is to have separate views loaded from separate nibs for each orientation.

要进行设置,请参见此处:

To set this up, see here: Easiest way to support multiple orientations? How do I load a custom NIB when the application is in Landscape?