Get UIBezierPath Stroke's Outline Path

后端 未结 1 748
抹茶落季
抹茶落季 2021-01-19 04:40

I have a UIBezierPath stroke, now I want to get the stroke\'s outline path(not the stroke\'s path itself), is there a way I could get that? or at least NS

相关标签:
1条回答
  • 2021-01-19 05:20

    You can use CGPathCreateCopyByStrokingPath for this.

    UIBezierPath *path = ...;
    CGFloat lineWidth = 10;
    CGPathRef cgStrokedPath = CGPathCreateCopyByStrokingPath(path.CGPath, NULL,
        lineWidth, kCGLineCapRound, kCGLineJoinRound, 0);
    UIBezierPath *strokedPath = [UIBezierPath bezierPathWithCGPath:cgStrokedPath];
    
    0 讨论(0)
提交回复
热议问题