裁剪后的图像不是很清晰

时间:2016-02-17 00:53:24

标签: swift imageview crop

我正在将图像视图裁剪成圆圈。当我这样做时,图像不清晰。如何在裁剪图像时使图像清晰?

.toDouble()

enter image description here

1 个答案:

答案 0 :(得分:0)

Sample Image

我认为您的代码很好,但我通常将clipToBounds = true和masksToBounds添加到false以获得我想要的结果。另外,请确保profilePicture的宽度和高度相同,并将contentMode设置为.Center

profilePicture.frame = CGRectMake(0, 0, 64, 64)
profilePicture.contentMode = .Center
profilePicture.layer.cornerRadius = (profilePicture.frame.size.width) / 2
profilePicture.layer.masksToBounds = false
profilePicture.clipToBounds = true