2017-03-03 71 views
3

我有一個UIBezierPath中風,現在我想要得到的筆劃的輪廓路徑(未描邊的路徑本身),是有辦法,我能得到什麼?或者至少NSLogUIBezierPath中風的輪廓路徑?由於獲取UIBezierPath中風的輪廓路徑

回答

5

您可以使用CGPathCreateCopyByStrokingPath這一點。

UIBezierPath *path = ...; 
CGFloat lineWidth = 10; 
CGPathRef cgStrokedPath = CGPathCreateCopyByStrokingPath(path.CGPath, NULL, 
    lineWidth, kCGLineCapRound, kCGLineJoinRound, 0); 
UIBezierPath *strokedPath = [UIBezierPath bezierPathWithCGPath:cgStrokedPath]; 
+0

這正是我要找的!謝謝!! – jane

+0

記得撥打'CGPathRelease(cgStrokedPath);'! – JimmyB