基于轮换更改XIB文件的最佳方法? [英] Best way to change XIB files based on rotation?
问题描述
到目前为止,我的应用程序只是一个基于肖像的应用程序.但是,我将横向模式添加到新版本中,但是发现从纵向旋转到横向时,我的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?
这篇关于基于轮换更改XIB文件的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!