Hide buttons when making a screenshot UIGraphicsBeginImageContextWithOptions

Posted by Jan on Stack Overflow See other posts from Stack Overflow or by Jan
Published on 2014-06-05T10:31:40Z Indexed on 2014/06/06 3:25 UTC
Read the original article Hit count: 265

Filed under:
|

is there a way to hide specific buttons (IBAction) when making a screenshot with UIGraphicsBeginImageContextWithOptions ?

I'm using the code below:

 // Define the dimensions of the screenshot you want to take (the entire screen in this case)
    UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);
    [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *sourceImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    //now we will position the image, X/Y away from top left corner to get the portion we want
    UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);
    [sourceImage drawAtPoint:CGPointMake(0, -20)];
    UIImage *croppedImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    UIImageWriteToSavedPhotosAlbum(croppedImage,nil, nil, nil);

Thank you for your answer!

© Stack Overflow or respective owner

Related posts about ios

Related posts about objective-c