UIBezierPath画圆

CGPointpointA =CGPointMake(60,10);

CGPointpointB =CGPointMake(110,60);

CGPointpointC =CGPointMake(60,110);

CGPointpointD =CGPointMake(10,60);

CGFloatoffset =100/3.6;

CGPointpointA1 =CGPointMake(pointA.x+ offset, pointA.y);

CGPointpointA2 =CGPointMake(pointB.x, pointA.y+offset);

CGPointpointB1 =CGPointMake(pointB.x, pointB.y+ offset);

CGPointpointB2 =CGPointMake(pointC.x+ offset, pointC.y);

CGPointpointC1 =CGPointMake(pointC.x- offset, pointC.y);

CGPointpointC2 =CGPointMake(pointD.x, pointD.y+offset);

CGPointpointD1 =CGPointMake(pointD.x, pointD.y- offset);

CGPointpointD2 =CGPointMake(pointD.x+ offset, pointA.y);

self.circlePath= [UIBezierPathbezierPath];

[self.circlePathmoveToPoint:pointA];

[self.circlePathaddCurveToPoint:pointBcontrolPoint1:pointA1controlPoint2:pointA2];

[self.circlePathaddCurveToPoint:pointCcontrolPoint1:pointB1controlPoint2:pointB2];

[self.circlePathaddCurveToPoint:pointDcontrolPoint1:pointC1controlPoint2:pointC2];

[self.circlePathaddCurveToPoint:pointAcontrolPoint1:pointD1controlPoint2:pointD2];

self.circleLayer= [CAShapeLayerlayer];

self.circleLayer.lineWidth=3;

self.circleLayer.fillColor= [UIColorblackColor].CGColor;

self.circleLayer.path=self.circlePath.CGPath;

self.layer.frame=CGRectMake(100,100,120,120);

//[self.layer.mask addSublayer:self.layer];

self.layer.mask=self.circleLayer;

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

推荐阅读更多精彩内容