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;

你可能感兴趣的:(UIBezierPath画圆)