我知道,如果您使用 CGPath 函数进行绘制,您无论如何都必须在最后将该 CGPath 添加到 CGContext (CGContextAddPath),但是选择第一种方法比第二种方法有什么优势/劣势吗?是的,我知道您也可以使用 UIBezierPath 进行绘图,而且我知道 CGPath 之间的区别。
最佳答案
因此,通过 UIBezierPath 上的文档,我发现了通过 CGContext 函数进行绘图的优势之一:
The advantage of modifying the graphics context (as opposed to the path object itself) is that you can easily undo the transformation by saving and restoring the graphics state. UIBezierPath documentation
我想出的另一个方法是,如果您通过 CGContext 函数绘制,则不必释放路径 (CGPathRelease)。
关于ios - 通过 CGContext 函数(CGContextAddArc 等)与 CGPath 函数(CGPathAddArc 等)绘图之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36309166/