I use this method for taking a snapshot:
UIView *snapshotView = [someView snapshotAfterScreenUpdates:NO];
This gives me a UIView that I can play with.
But, I need the UIImage of it and not the UIView.
This is the method I use for converting a UIView to an UIImage:
- (UIImage *)snapshotOfView:(UIView *)view
{
UIImage *snapshot;
UIGraphicsBeginImageContext(view.frame.size);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
snapshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return snapshot;
}
It doesn't work, the snapshot is a blank UIImage because the snapshotView isn't rendered.
The obvious thing to do is to directly take a snapshot of the view instead of taking the snapshot in the form of a UIView and then converting it.
The problem with the obvious method is that I'm using a WKWebView that has a huge bug that doesn't allow you to take screenshots. And that's true, I even reported the bug and they said they are trying to fix it.
So, how can I take the snapshot (UIImage) of the snapshotView without rendering it?