Skip to content

Instantly share code, notes, and snippets.

@justinHowlett
Created June 20, 2013 23:40
Show Gist options
  • Select an option

  • Save justinHowlett/5827739 to your computer and use it in GitHub Desktop.

Select an option

Save justinHowlett/5827739 to your computer and use it in GitHub Desktop.

Revisions

  1. justinHowlett created this gist Jun 20, 2013.
    19 changes: 19 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    #include <QuartzCore/QuartzCore.h>

    @implementation UIView (Raster)

    -(UIImage*)getRasterCopy{

    /* returns UIImage of any UIView */

    UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, 0.0);

    [self.layer renderInContext:UIGraphicsGetCurrentContext()];

    UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return resultingImage;
    }

    @end