daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top