Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UIGraphicsBeginImageContext(self.view.bounds.size);
- CGContextRef ctx = UIGraphicsGetCurrentContext();
- [[[self view] layer] renderInContext:ctx];
- UIImage *savedImg = UIGraphicsGetImageFromCurrentImageContext();//here is the whole screen image
- UIGraphicsEndImageContext();
- CGImageRef croppedCGImage = CGImageCreateWithImageInRect([savedImg CGImage], self.theBodies.frame);
- UIImage *croppedUIImage = [UIImage imageWithCGImage:croppedCGImage];
- CGImageRelease(croppedCGImage);
- return croppedUIImage;
Add Comment
Please, Sign In to add comment