I am trying to get a screen grab of a view that has a SKScene in it. The technique I am using is:
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, scale);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
This works great with normal UIViews, but for whatever reason it is ignoring all the sprites in the SKScene.
I'm not sure if this is a bug, or if Sprite Kit's rendering is separate from UIGraphics.
Question: How do I get a screen grab of an SKScene when the way that worked for UIViews seems to not work with Sprite Kit, or has anyone had success using UIGraphics context with Sprite Kit?
See Question&Answers more detail:os