UIBezierPath的使用

1. 画线(实线与虚线)

UIBezierPath * xPath = [UIBezierPath bezierPath];

[xPath moveToPoint:CGPointMake(YLabelWidth + width * i, height)];//设置初始点的位置

[xPath addLineToPoint:CGPointMake(YLabelWidth + width * i, 0)];

CAShapeLayer * xLayer = [CAShapeLayer layer];

xLayer.strokeColor = _lineDashColor.CGColor;

xLayer.fillColor = [UIColor clearColor].CGColor;

xLayer.lineDashPattern = @[@3,@2];//三个像素的实线,两个像素的空格构成的虚线

xLayer.lineWidth = 1;

xLayer.path = xPath.CGPath;

[self.layer addSublayer:xLayer];

参考文章:*  http://justsee.iteye.com/blog/1972853  UIBezierPath的使用

*  http://www.jianshu.com/p/1d0e405f166e  CGContext的使用

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容