获取UIBezierPath中风的轮廓路径

问题描述:

我有一个UIBezierPath中风,现在我想要得到的笔划的轮廓路径(未描边的路径本身),是有办法,我能得到什么?或者至少NSLogUIBezierPath中风的轮廓路径?由于获取UIBezierPath中风的轮廓路径

您可以使用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