Just playing around with SpriteKit and am trying to figure out how to capture a 'grab' of an SKNode into a UIImage.
With UIView (or a UIView subclass), I have used the layer property of the view to render into a graphics context.
Eg.
#import <QuartzCore/QuartzCore.h>
+ (UIImage *)imageOfView:(UIView *)view {
UIGraphicsBeginImageContextWithOptions(view.frame.size, YES, 0.0f);
CGContextRef context = UIGraphicsGetCurrentContext();
[view.layer renderInContext:context];
UIImage *viewShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return viewShot;
}
SKNode is not a subclass of UIView and thus does not appear to be backed by a layer.
Any ideas of how I might go about rendering a given SKNode to a UIImage?