Ios 未调用SKView drawRect

Ios 未调用SKView drawRect,ios,sprite-kit,Ios,Sprite Kit,我正在尝试使用这个(由Aroth提供)在我的iOS SpriteKit游戏上进行屏幕截图 基本上,我需要用我自己的ScreenCaptureView(参见链接)替换UIViewController的SKView。我将示例中的ScreenCaptureView更改为派生自SKView,而不是UIView 我在游戏UIViewController类中重写loadView函数: - (void)loadView { ScreenCaptureView *newView = [[

我正在尝试使用这个(由Aroth提供)在我的iOS SpriteKit游戏上进行屏幕截图

基本上,我需要用我自己的ScreenCaptureView(参见链接)替换UIViewController的SKView。我将示例中的ScreenCaptureView更改为派生自SKView,而不是UIView

我在游戏UIViewController类中重写loadView函数:

- (void)loadView
    {
        ScreenCaptureView *newView = [[ScreenCaptureView alloc] init];
        newView.frame = CGRectMake(0, 0, 568, 320);//hard code for now
        newView.clipsToBounds = NO;
        self.view = newView;
        [newView setNeedsDisplay];
        NSLog(@"loadView %x", (int)newView);
    }

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSLog(@"viewDidLoad view %x %f x %f", (int)self.view ,self.view.frame.size.width, self.view.frame.size.height);
但它不起作用。ScreenCaptureView中的drawRect从未被调用


非常感谢您的帮助。

是否调用了loadview?是的,调用loadview时请尝试在viewdidlaod中执行相同的操作,而不是在loadviewI中执行。No deal.do setneeds在self.view=newView行之前显示