iOS Auto Layout缩小 [英] IOS Auto Layout scale down

查看:56
本文介绍了iOS Auto Layout缩小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建此视图,在该视图中,图像会粘在一起,并在设备变小时重新调整大小.每件事都行得通,但是我似乎唯一无法奏效的事情就是缩小比例.

I'm trying to create this view where images stick together and get resized when the device get smaller. Every thing works, but the only thing that I don't seem to get to work is the scale down.

从屏幕截图中可以看到,有两个框需要居中.框之间的空间始终与宽度和高度相同(例如100x100或50x50或25x25等).但是,这种简单的调整大小会使盒子变小,这是行不通的.你们知道我应该使用哪种自动布局属性吗?还是属性的组合?非常感谢您的帮助.

As you can see from the screenshot there are two boxes that need to be centered. The space between the boxes always remains the same as do the width and height (e.g. 100x100 or 50x50 or 25x25 etc.). But it's this simple resize where the boxes get smaller that doesn't work. Do you guys have any clue what kind of auto layout property I should use? Or the combination of properties? Help is much appreciated.

致谢

推荐答案

我完全同意@rdelmar answer ... +1的答案...

I am absolutely agree with @rdelmar answer ... +1 for the answer...

实际上,要保持任何对象的比例,您需要使用宽高比,例如在大屏幕中使用100x100,在小屏幕中使用50x50 ...对于其他视图尺寸来说也一样...

Actually for a maintain ratio of any object you need to use aspect ratio like 100x100 in bigger screen and 50x50 in smaller screen...same for other view sizes...

并且由于我们希望两个对象的高度和宽度都相同,因此我们必须将一个对象的宽度和高度分配给另一个对象...

and as we want both object to be same in terms of height and width, we have to give equal width and height of one object to another...

为了更好地理解它是如何完成的...这里是视觉格式.

For a better understanding how it done ...here is the visual format..

这是您想要的输出...

And Here is the output as you want...

这篇关于iOS Auto Layout缩小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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