在圆形UIImageView中获取压缩的图像

问题描述 投票:0回答:1

我正在制作个人资料照片。

我在故事板上添加了一个UIImageView(比如userImageView),方面模式为SCALE TO FILL并在我的swift文件中添加了以下代码

self.userImageView.layer.borderWidth = 10
self.userImageView.layer.borderColor = UIColor.white.cgColor
self.userImageView.layer.cornerRadius = self.userImageView.frame.height/2
self.userImageView.clipsToBounds = true

但是当试图从相机或相册添加图像时,图像会被压缩。

我也试图调整图像大小,但仍然,图像正在压缩。

我究竟做错了什么?

ios swift uiimageview
1个回答
5
投票

故事板内容模式是纵横填充或适合,然后单击剪辑以限制其帮助以使图像适合图像视图边界

© www.soinside.com 2019 - 2024. All rights reserved.