简体   繁体   English

iOS故事板布局

[英]iOS storyboard layout

I am working on an app and have come into some graphical problems when designing my app. 我正在开发一个应用程序,在设计我的应用程序时遇到了一些图形问题。

First off, my app is only support by iPhone. 首先,我的应用仅受iPhone支持。 My current storyboard is using the iPhone 5 as the screen size, so everything screws up when I try to run in iPhone 4 and 4S. 我当前的情节提要板使用iPhone 5作为屏幕尺寸,因此当我尝试在iPhone 4和4S上运行时,一切都会变糟。 Is there a way to make multiple storyboards for each different screen size? 有没有办法为每个不同的屏幕尺寸制作多个情节提要? Or do you all have another solution? 还是你们都有其他解决方案?

Thanks! 谢谢! - Brad -布拉德

There is a way to make different storyboards for separate screen sizes, but another way to do it is like this: 有一种方法可以为不同的屏幕尺寸制作不同的故事板,但是另一种方法是这样的:

Whenever you add objects to your views, be sure to have them aligned to something (using constraints). 每当将对象添加到视图时,请确保它们与某物对齐(使用约束)。 If all items are relative to other items, then most likely the layout will be fine on all devices. 如果所有项目都相对于其他项目,则布局很可能在所有设备上都可以。 Also, if you find that your controls start overlapping, then perhaps you ran out of room. 另外,如果您发现控件开始重叠,则可能是空间不足。 In that case simply add a scroll view to your layout, and then put the controls on top of it. 在这种情况下,只需将滚动视图添加到布局中,然后将控件放在其顶部即可。 Then, it won't scroll on the larger screens because all controls are shown, but on smaller devices it will allow you to scroll down to see the rest of the objects. 然后,它不会在大屏幕上滚动,因为会显示所有控件,但是在较小的设备上,它将允许您向下滚动以查看其余对象。

Good luck. 祝好运。

There is a small button in the lower right hand corner that lets you toggle between 3.5" and 4" screen sizes so you can see how it will look on different devices. 右下角有一个小按钮,可让您在3.5“和4”屏幕尺寸之间进行切换,以便查看在不同设备上的外观。 By using Auto Layout introduced in iOS 6 you can make sure to set up your constraints so that your UI looks good on both older and newer iPhones. 通过使用iOS 6中引入的“自动布局”,您可以确保设置约束,以使UI在新旧iPhone上看起来都不错。

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

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