简体   繁体   English

为iOS 6创建视图

[英]Creating views for iOS 6

I was wondering if someone could explain to me how to create views that work for both for iPhone 5 and prior models. 我想知道是否有人可以向我解释如何创建适用于iPhone 5和以前型号的视图。 I have done my research and have found people suggesting the use of 我进行了研究,发现有人建议使用

setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight

But I have the following questions regarding this. 但是我对此有以下疑问。

  1. If I am building in interface builder and plan on using the above line of code, do I leave the size option at "Retina 4 Full Screen"? 如果我在界面生成器中构建并计划使用上述代码行,我是否将size选项保留在“ Retina 4 Full Screen”?

  2. Will the above line of code account for images that were previously set at a specific location on 3.5 inch screens? 上面的代码行是否解释了以前在3.5英寸屏幕上的特定位置设置的图像?

  3. Is there a generic place I can put this line of code in my app so it does it for all views or do I need to put it in each viewController and within ViewDidLoad? 是否可以在我的应用程序中放置这行代码,以便对所有视图都适用,还是需要将其放置在每个viewController中以及ViewDidLoad中?

Thanks in advance! 提前致谢!

If you are planning to deploy app only on iOS6, then you can use autolayout option. 如果您打算仅在iOS6上部署应用程序,则可以使用自动布局选项。

If you are targeting iOS 6.0 and previous version then you can use view resizing with autoresizingMask. 如果您的目标是iOS 6.0和早期版本,则可以将视图调整大小与autoresizingMask一起使用。 One other approach you can use is that it can be to design separate views for iPhone 5 and iPhone 4S. 您可以使用的另一种方法是,可以为iPhone 5和iPhone 4S设计单独的视图。 Check screensize and load views accordingly, as in the case of universal apps. 与通用应用程序一样,检查屏幕尺寸并相应地加载视图。

Thanks, 谢谢,
Jim. 吉姆

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM