I need to take a screenshot of the app. There is a button to trigger it, but I don't want the button to appear in the screenshot.
I have the following code:
- (IBAction) takePicture:(id) sender {
button.hidden = YES;
CGImageRef screen = UIGetScreenImage();
UIImage* image = [UIImage imageWithCGImage:screen];
CGImageRelease(screen);
// Save the captured image to photo album
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
button.hidden = NO;
}
But the button still appears in the screenshot. What am I doing wrong?