自动布局宽高比的UIImageView / UIView的 [英] Autolayout aspect ratio for UIImageView / UIView

查看:372
本文介绍了自动布局宽高比的UIImageView / UIView的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置自动布局为的UIImageView / UIView的使图像视图的宽度和高度增加了位为iPhone 6,6加。我曾尝试添加约束长宽比,但增加的高度和宽度都非常大。反正是有设定限制高度和图像视图的宽度可以手动设置为iPhone 6,6加。看看截图在iPhone 6,6加上图像视图应略小于它现在呈现。

How to set autolayout for UIImageView /UIView so that the image view width and height increases a bit for iphone 6 and 6 plus. I have tried adding the constraint Aspect ratio but the increased height and width are very big. Is there anyway to set the constraint height and width of image view can be set manually for iphone 6 and 6 plus. Take a look at the screenshot the image view in iphone 6 and 6 plus should be little smaller than it is showing now.

推荐答案

据我了解你的问题是要控制多少图像将在每一个不同的屏幕尺寸增加。您可以控制​​一切。你需要做的就是指定一个相当于你的图像宽度约束。在图像的宽度preferable。的关系将与上海华,然后你可以通过添加自己的乘数变化之间的关系。

As I understood your problem is that you want to control how much the image will be increased in each different screen size. You can control everything. What you need to do is to assign an equals width constraint on your image. Preferable on image's width. The relation will be with the superview and then you can change the relation by adding your own Multiplier.

您需要做的正是:

1)选择您的图像视图。

1) Select your image view.

2)按住Ctrl键。当你拿着它,从图像视图外视图中拖动鼠标。

2) Hold down the control key. While you are holding it, drag your mouse from the image view to the outer view.

3)选择等于宽度。

3) Select 'Equals width'.

4)你的约束双击在约束选项卡。

4) Double click on your constraint in the 'Constraints' tab.

5)确保图像的看法是psented作为第一个项目$ P $,如果不是第一个项目单击,然后选择反向第一和第二个项目。

5) Ensure that the image view is presented as the first item, if not click on the first item and select 'Reverse first and second item'.

6)与乘法器玩,直到你满意的preVIEW屏幕上的结果。

6) Play with the multiplier until you are satisfied with the result on the preview screen.

这篇关于自动布局宽高比的UIImageView / UIView的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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