Is it possible to take a path draw in an UIView with CGPath and export it as a PNG?
The cleanest way to do that is to perform the whole drawing again in an image context produced by UIGraphicsBeginImageContext()
, get an UIImage
out of it, then save it via the UIImagePNG/JPEGRepresentation()
functions.
Note that UIView do not "hold" images. You can rerender a UIView's layer, but it's a gross violation of MVC (you're using views to store model data!), and it doesn't look clean to me.