简体   繁体   中英

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. 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?

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?

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.

Leading constraint:

领导

Width constraint:

宽度

Top constraint:

最佳

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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