我想繪製一個使用UIBezierPath和ZEPolygon的六角形,它的工作原理很棒,但是我的六邊形是平頂的。我嘗試了所有的方法,讓它在中間畫一個點,包括工作路徑上的180度轉換,但其他所有的東西都打破了。用UIBezierPath繪製六角形(點第一個)
This is how i would like it to look
我的代碼如下
UIImageView *maskedImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.png"]];
UIBezierPath *nonagon = [UIBezierPath bezierPathWithPolygonInRect:maskedImageView.frame numberOfSides:6];
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.path = nonagon.CGPath;
maskedImageView.layer.mask = shapeLayer;
[self.view addSubview:maskedImageView];
This is the library i used for the drawing the bezier path
感謝所有幫助
180度變換下?你不想要90嗎? –
對不起,90度是正確的,但偏移量都是不正確的,下面的圖像是沒有看到的地方 –