Guest User

Untitled

a guest
Jun 13th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. - (void)captureButtonAction:(id)sender {
  2. UIView *cameraView = [[[[[[[[self.view subviews] objectAtIndex:0]
  3. subviews] objectAtIndex:0]
  4. subviews] objectAtIndex:0]
  5. subviews] objectAtIndex:0];
  6.  
  7. CGRect screenRect = [[UIScreen mainScreen] bounds];
  8. UIGraphicsBeginImageContext(screenRect.size);
  9.  
  10. CGContextRef ctx = UIGraphicsGetCurrentContext();
  11. [cameraView.layer renderInContext:ctx];
  12.  
  13. UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
  14. UIGraphicsEndImageContext();
  15.  
  16. UIImageWriteToSavedPhotosAlbum(viewImage, self, nil, nil);
  17. NSLog(@"capture button action");
  18. }
Add Comment
Please, Sign In to add comment