【发布时间】:2015-08-05 04:11:47
【问题描述】:
我正在尝试制作一个圆形图像配置文件,例如 instagram/whatsapp 的配置文件图像。现在我的代码似乎可以正常工作,但我以两种不同的方式完成了它,并且两种方法都有效,所以我想知道哪个是最好的
第一种方式:
profileImageView.layer.cornerRadius = profileImageView.frame.width / 2
profileImageView.clipsToBounds = true
第二种方式
profileImageView.layer.cornerRadius = profileImageView.frame.width / 2
profileImageView.layer.masksToBounds = true
我还想知道是否有人可以向我解释“clipToBounds”和“maskToBounds”的作用。谢谢!
【问题讨论】:
-
您可以查看
clipsToBounds和masksToBounds: stackoverflow.com/questions/1177775/…
标签: ios swift uiimageview