How do I create a CGImage from UIView Subclass?
Should I use renderInContext:UIGraphicsGetCurrentContext() to create a CG image from a view (subclass of UIView) that contains a drawing (core graphics via drawRect method)?
I have an view, myView, in which I am doing some drawing. I want to do some other core graphics operations with the drawing I have created - like blend modes etc with imported photos, so I need to get a CGimage from myView I assume. Not finding a CGImage property (my first guess). Poking around I found the solution below, but my subclass "does not declare the selector renderInContext", so I get an error.
UIGraphicsBeginImageContext(myView.bounds.size);
[myView renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
CGImageRef cgImage = image.CGImage;