美文网首页
设置View类部分圆角

设置View类部分圆角

作者: 阴中阳 | 来源:发表于2016-12-17 19:42 被阅读8次
// 设置一个View类型的半边圆角A

 let path = UIBezierPath(roundedRect: Setting.bounds, byRoundingCorners: [UIRectCorner.topRight, UIRectCorner.bottomRight], cornerRadii: CGSize(width: 5, height: 5))
        let shapeLayer = CAShapeLayer()
        shapeLayer.path = path.cgPath
        Setting.layer.mask = shapeLayer
  • 只需要修改[UIRectCorner.topRight, UIRectCorner.bottomRight]
  • 例子设置了右边的两个圆角

相关文章

网友评论

      本文标题:设置View类部分圆角

      本文链接:https://www.haomeiwen.com/subject/jhqamttx.html