Created
October 5, 2011 03:01
-
-
Save Nub/1263517 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| + (UIImage *)screenShot:(UIView *)aView inRect:(CGRect)aRect | |
| { | |
| // Arbitrarily masks to 40%. Use whatever level you like | |
| UIGraphicsBeginImageContext(aRect.size); | |
| CGContextRef context = UIGraphicsGetCurrentContext(); | |
| CGContextTranslateCTM(context, 0, -aRect.origin.y); | |
| [aView.layer renderInContext:context]; | |
| UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); | |
| CGContextSetRGBFillColor (context, 0, 0, 0, 0.4f); | |
| CGContextFillRect (context, aRect); | |
| UIGraphicsEndImageContext(); | |
| return image; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment