CAShapeLayer

作者: 淇滨杜隆坦 | 来源:发表于2016-07-06 16:53 被阅读62次

参看放肆地使用UIBezierPath和CAShapeLayer画各种图形
参看使用CAShapeLayer与UIBezierPath可以实现不在view的drawRect方法中就画出一些想要的图形

CAShapeLayer 是 CALayer 的子类,但比 CALayer 更灵活,可以画出各种图形,当然,你也可以使用其他方式来画,随你。

<br />

使用CAShapeLayer与UIBezierPath可以实现不在view的drawRect方法中就画出一些想要的图形

步骤:

1、新建UIBezierPath对象bezierPath

2、新建CAShapeLayer对象caShapeLayer

3、将bezierPath的CGPath赋值给caShapeLayer的path,即caShapeLayer.path = bezierPath.CGPath

4、把caShapeLayer添加到某个显示该图形的layer中

相关文章

网友评论

    本文标题:CAShapeLayer

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