SpriteKit をいじって、SKNode の「グラブ」を UIImage にキャプチャする方法を見つけようとしています。
UIView (または UIView サブクラス) を使用してlayer
、ビューのプロパティを使用してグラフィックス コンテキストにレンダリングしました。
例えば。
#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 は UIView のサブクラスではないため、レイヤーによってサポートされているようには見えません。
特定の SKNode を UIImage にレンダリングする方法についてのアイデアはありますか?