简体   繁体   English

UIImageView缩放以填充

[英]UIImageView Scale to fill

I have a UIImageView with a UIImage I set directly in the Storyboard/IB. 我有一个UIImageView和一个我直接在Storyboard / IB中设置的UIImage I've also selected the Scale to Fill Mode 我还选择了“ Scale to Fill模式

And this is what it looks like in IB/Storyboard: 这就是IB / Storyboard中的样子: 在此处输入图片说明

However when I run the app it looks like this: 但是,当我运行该应用程序时,它看起来像这样: 在此处输入图片说明

Any ideas on how I could fix this? 关于如何解决此问题的任何想法? I've tried changing mode in the storyboard/IB to say for example the center mode, this however just gives me a part of the image taken from the center of it. 我曾尝试在情节提要/ IB中更改模式,例如说中心模式,但这只是给了我一部分从中心获取的图像。

Seems that I didn't connect constraints to all points. 似乎我没有将约束连接到所有点。 Doing so and making sure all constraint lines were blue solved it. 这样做并确保所有约束线都为蓝色即可解决该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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