gpt4 book ai didi

iOS 圆角个人资料图像的干净角落

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:26:29 28 4
gpt4 key购买 nike

所以我关注了一个 AppCoda关于个人资料图像四角圆角的教程,它工作正常,除了一件事。无论图像是圆形的,图像都会有一点渗色(尤其是在使用白色边框的情况下)。

enter image description here

self.imageview.image = image
self.imageview.layer.cornerRadius = 10.0
self.imageview.layer.borderWidth = 3.0
self.imageview.layer.borderColor = UIColor.whiteColor().CGColor
self.imageview.clipsToBounds = true

enter image description here

最佳答案

如果需要,您还可以添加一个稍微嵌入的 mask :

let path = UIBezierPath(roundedRect: CGRectInset(imageView.bounds, 0.5, 0.5), cornerRadius: 10.0)
let mask = CAShapeLayer()
mask.path = path.CGPath
imageview.layer.mask = mask

关于iOS 圆角个人资料图像的干净角落,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28822940/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com