小编Sha*_*man的帖子

如何将圆角半径添加到 UIView 周围的虚线边框

我有一个圆形,UIView并在其中添加了一条虚线描边。

,,,
    var view = CAShapeLayer()
    view.strokeColor = UIColor.red.cgColor
    view.lineDashPattern = [2, 2]
    view.frame = addphotoView.bounds
    view.fillColor = nil
    view.path = UIBezierPath(rect: addphotoView.bounds).cgPath
    view.cornerRadius = 16
    view.masksToBounds = true

    addphotoView.layer.addSublayer(yourViewBorder)
Run Code Online (Sandbox Code Playgroud)

view.cornerRadius没有按预期工作: 演示

角落被抹去。

calayer uiview ios swift

4
推荐指数
1
解决办法
1727
查看次数

标签 统计

calayer ×1

ios ×1

swift ×1

uiview ×1