Saving a view as an image.
Another real quick tip for you. Depending on what you’re doing, why might want to capture a view and store it as an image. The frameworks make this quick and painless.
The first step you should take is to create a new image context in which we will be working. The next step is to render the view’s CALayer into that new context. Finally, we get an image from that context and close out the context.
In the following code, I use the UIWindow (UIView subclass) for the sample as a way to get a quick and easy screenshot.
