// 绘制正n变形
CGFloat X = polygonView.frame.size.width * 0.5;
CGFloat Y = polygonView.frame.size.height * 0.5;
UIBezierPath* bezierPath = [UIBezierPath bezierPath];
bezierPath.lineCapStyle = kCGLineCapRound;
bezierPath.lineJoinStyle = kCGLineCapRound;
CGFloat angle = labs(360/n);
[bezierPath moveToPoint: CGPointMake(X - X , Y)];
for (int i = 0; i < n - 1; i ++) {
CGFloat angle1 = angle *(i + 1);
CGFloat X1 = X + (X * (cos(M_PI *angle1/180)))*(-1);
CGFloat Y1 = Y + X * (sin(M_PI *angle1/180));
[bezierPath addLineToPoint: CGPointMake(X1, Y1)];
}
[bezierPath addLineToPoint: CGPointMake(X - X , Y)];
CAShapeLayer *layer = [CAShapeLayer layer];
layer.path = [bezierPath CGPath];
polygonView.backgroundColor = [UIColor redColor];
polygonView.layer.mask = layer;