获取UIBezierPath描边的轮廓路径 [英] Get UIBezierPath Stroke's Outline Path

查看:122
本文介绍了获取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描边的轮廓路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆