如何为iPhone 6 +,6和5指定不同的尺寸? [英] How to specify different sizes for iPhone 6+, 6 and 5?

查看:96
本文介绍了如何为iPhone 6 +,6和5指定不同的尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使iPhone 6 +,6和5上的视图几乎相同. 在所附图片中,我的意思是,例如,取消"按钮应距iPhone 5屏幕左边缘30像素,6像素应为35 px,6 +像素应为45 px,其他元素类似.

I want to make the view look almost same on each of iPhone 6+, 6 and 5. In the attached picture, I mean, that, for example, "Cancel" button should be 30 pixels from left edge of screen in iPhone 5, 35 px in 6 and 45 px for 6+ and the similar for other elements.

如何为每种类型放置特定的约束大小?如果我在约束中使用比例,则按钮会增大,但是按钮的大小不受控制,并且元素之间的间距也无法更改.具有特定约束尺寸的尺寸类别我也无法使用,因为cW aH适用于5台和6台iphone. (据我了解).

How can specific constrains sizes be placed for each type of it? If I use proportions in constrains, so buttons grow, but their sizes not controlled and spaces between elements I cant change also. Size classes with specific constrains sizes I also can`t use, because cW aH is for 5 and 6 iphones the same. (as I understood).

我不知道该怎么做. 现在通常如何管理6和6+的不同设计?

I can`t figure out how to do it. How usually different designs for 6 and 6+ managed now?

推荐答案

为什么需要选择30、35和45px?像素化的位置是否有原因?

Why do you need to pick 30, 35 and 45px ? Is there a reason for that pixelish placement ?

您可以通过使用它们的乘数值而不是常量来使用更灵活的约束.

You can use more flexible constraints by using their multiply value instead of the constant.

约束将根据超级视图的尺寸进行调整.

The constraints adjusts themselves depending on the superview dimensions.

iPhone5 - iPhone 6 - iPhone 6+ - iPad - iPhone4横向

iPhone5 - iPhone 6 - iPhone 6+ - iPad - iPhone4 landscape

请注意如何配置中心X对齐约束:

您会看到这些值表现得有些奇怪,有时乘数> 1,有时在1至2之间,或者< 1,具体取决于First ItemSecond Item的顺序.您仍然可以通过单击它们并选择Reverse First And Second Item来交换其订单.

You can see that the values behaves kind of strangely, sometimes multiplier is > 1, sometimes it's between 1 and 2, or < 1 depending on the order of First Item and Second Item. You still can swap their order by clicking on them and selecting Reverse First And Second Item.

这篇关于如何为iPhone 6 +,6和5指定不同的尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆