本文介绍了获取UIBezierPath描边的轮廓路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UIBezierPath笔触,现在我想获取该笔触的轮廓路径(而不是该笔触的路径本身),有什么办法可以实现?或至少NSLog UIBezierPath笔触的轮廓路径?谢谢

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 NSLog the UIBezierPath stroke's outline path? Thanks

推荐答案

您可以为此使用CGPathCreateCopyByStrokingPath.

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

这篇关于获取UIBezierPath描边的轮廓路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-02 00:06