简体   繁体   English

在圆形UIImageView中获取压缩图像

[英]image in getting compress in circular UIImageView

I am working on a profile pic. 我正在处理个人资料照片。

I have added an UIImageView (say userImageView) on the storyboard with aspect mode SCALE TO FILL & added below code in my swift file 我已经在情节提要板上添加了一个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

but when tried to add an image from camera or album, image is getting compressed. 但是当尝试从相机或相册添加图像时,图像被压缩。

I have also tried to resize the image but still, the image is getting compress. 我也尝试过调整图像的大小,但是图像仍在压缩。

What am I doing wrong? 我究竟做错了什么?

在故事板内容模式下为宽高比填充或适合,然后单击剪辑以限制其帮助以使图像适合图像视图范围

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

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