Guest User

Untitled

a guest
Jul 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. UIGraphicsBeginImageContext(self.view.bounds.size);
  2. CGContextRef ctx = UIGraphicsGetCurrentContext();
  3. [[[self view] layer] renderInContext:ctx];
  4.  
  5. UIImage *savedImg = UIGraphicsGetImageFromCurrentImageContext();//here is the whole screen image
  6. UIGraphicsEndImageContext();
  7.  
  8. CGImageRef croppedCGImage = CGImageCreateWithImageInRect([savedImg CGImage], self.theBodies.frame);
  9. UIImage *croppedUIImage = [UIImage imageWithCGImage:croppedCGImage];
  10. CGImageRelease(croppedCGImage);
  11.  
  12. return croppedUIImage;
Add Comment
Please, Sign In to add comment