[英]UIImageView frame aspect ratio fault?
I have a UIImageView that I want to automatically adjust its size varying on the device its being ran on, my application is universal meaning 4s-ipad Air. 我有一个UIImageView,我想根据正在运行的设备自动调整其大小,我的应用程序具有通用性,即4s-ipad Air。 It seems every combination of Auto Layout constrain I attempt, there's a conflict.
似乎我尝试的“自动版式”约束的每种组合都存在冲突。 What combination of constrains should I use to center this ImageView in the container as well as make it adjust its size?
我应该使用哪种约束条件来组合此ImageView在容器中居中并调整其大小?
update 更新
So Everything looks perfect in the preview below: 因此,在下面的预览中,一切看起来都很完美:
but when i run it on iphone 4S, its not there, and when I change the orientation on any other screen it disappears, what would be a solution? 但是当我在iphone 4S上运行它时,它不在那儿,而当我在其他任何屏幕上更改方向时,它消失了,那将是一个解决方案?
I would recommend using relative constraints to solve this problem: 我建议使用相对约束来解决此问题:
It will allow you to specify all the sizes not explicitly but using multipliers, as a percentage of the sizes of superview. 它将允许您不显式地指定所有大小,而是使用乘数(作为Superview大小的百分比)。
Leading constraint: 前导约束:
Width constraint: 宽度限制:
Top constraint: 最高约束:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.