Return to Snippet

Revision: 37415
at December 9, 2010 20:13 by vaishnavi


Initial Code
- (UIImage*)imageFromView{

    UIImage *image;

    UIGraphicsBeginImageContext(self.view.bounds.size);
    [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
    image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return image;

}

Initial URL


Initial Description
Any view and it's subviews will be "flattened" into a UIImage that you can display or save to disk.

Initial Title
Take any view and make a UIImage out of it.

Initial Tags


Initial Language
Objective C