如何将图像大小设为 imageview 大小

问题描述

enter image description here

我有 UIImageView 圆角矩形形状,如您在图片中看到的那样用颜色突出显示。我想用图像完全填充 UIImageview。

解决方法

使用 imageView contentMode

imageView.contentMode = .scaleAspectFill

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...