简体   繁体   English

适用于iphone5和其他iphone的iOs 6种不同的故事板

[英]iOs 6 different storyboards for iphone5 and other iphones

I have been developing an app for iOs5. 我一直在为iOs5开发一个应用程序。 Now that the new iPhone is here (with iOs 6) I ran the app in the simulator (iPhone 4 - inch retina) and much of the views don't display properly... What is the best course of action? 既然新的iPhone已经在这里(使用iOs 6)我在模拟器(iPhone 4英寸视网膜)中运行应用程序并且大部分视图都无法正常显示...最佳的行动方案是什么? Is it possible to create another storyboard for the 4-inch display? 是否可以为4英寸显示屏创建另一个故事板? Or setting up the struts and springs will auto-adjust the views to fit the new display better? 或者设置支柱和弹簧会自动调整视图以更好地适应新显示器?

After testing this myself it looks like the struts and springs will fix this for the most part. 在自己测试之后,看起来像支柱和弹簧将在大多数情况下解决这个问题。 If however you are creating your views programmatically you will most likely have to make some changes if you put static widths and heights. 但是,如果您以编程方式创建视图,则在放置静态宽度和高度时,您很可能需要进行一些更改。 I ran into an instance of this where I have UIWebViews being populated in a UiScrollView and it did not fill up the screen since I was setting the height statically 323. Here is what the adjustment was: 我遇到了一个这样的实例,我在UiScrollView中填充了UIWebViews ,因为我静态设置了高度323,所以它没有填满屏幕。这是调整的结果:

CGRect rect = webView.frame; CGRect rect = webView.frame;
rect.size.height = myScrollView.bounds.size.height; rect.size.height = myScrollView.bounds.size.height; (this used to be 323) (这曾经是323)
rect.size.width = myScrollView.bounds.size.width; rect.size.width = myScrollView.bounds.size.width;

This was able to fix the height setting since myScrollview was set to fill the entire display. 由于myScrollview设置为填满整个显示,因此可以修复高度设置。

You should set springs or struts for our views in the size inspector so that they resize correctly with the scene. 您应该在尺寸检查器中为我们的视图设置弹簧或支柱,以便它们与场景正确调整大小。 There's a button in the lower right corner of the canvas to stretch or compress all top level full screen views between iPhone 5 and pre iPhone 5 sizes. 在画布的右下角有一个按钮,用于拉伸或压缩iPhone 5和iPhone 5之前的所有顶级全屏视图。 You can use this to verify that your springs and struts are setup correctly. 您可以使用它来验证弹簧和支柱是否正确设置。

If your minimum deployment target is iOS 6.0+, you can use auto layout instead of springs and struts. 如果您的最低部署目标是iOS 6.0+,则可以使用自动布局而不是弹簧和支柱。 This will give you much more fine grained control over how your interface resizes. 这将为您提供更精细的控制界面调整大小的控制。

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

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