2

I have a hidden UIView that I need to take a full screenshot of. I don't want to .hidden = NO * take screenshot * .hidden = YES. The reason is because that causes an inverted looking screenshot sometimes.

+ (UIImage *) imageWithView:(UIView *)view
{
    UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0);
    [view.layer renderInContext:UIGraphicsGetCurrentContext()];

    UIImage * img = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return img;
}

This is my code, it does nothing if the UIView is hidden.

Take a snapshot of a hidden UIView -- Doesn't work

I've googled around and haven't found an answer. Please respond with code in Objective-C.

digit
  • 197
  • 9

1 Answers1

0

from your given link, the another view should ONLY cover your view and then set hidden to false/NO fro your view meaning your view should be visible behind the cover view. That's working perfectly. keep your view you want to draw at bottom in view hierarchy and the cover view covering your view.

Van
  • 1,225
  • 10
  • 18