Frage

I have a bezier path inside the current graphics context that I want to store as a UIBezierPath or CGPath. Do you know how to get the path out of a CGContextRef?

War es hilfreich?

Lösung

You can copy the context's current path using CGContextCopyPath.

There is no function that copies the clipping path. Indeed, the clipping region won't be defined by a path if you've used CGContextClipToMask.

Andere Tipps

You can use the CGContextCopyPath function:

CGPathRef myPath = CGContextCopyPath(context);

Swift 4.0 and higher

You can just use for coping the path.

let copy = context.path
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top