Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cocos2d iphone 使用CCLayerPanZoom而不是CCLayer时出现黑屏_Cocos2d Iphone - Fatal编程技术网

Cocos2d iphone 使用CCLayerPanZoom而不是CCLayer时出现黑屏

Cocos2d iphone 使用CCLayerPanZoom而不是CCLayer时出现黑屏,cocos2d-iphone,Cocos2d Iphone,为了能够平移和缩放屏幕上的一些内容,我决定使用CCLayerPanZoom扩展。当我查看源代码时,我可以看到它是从CCLayer类派生的。因此,我将推送到导航堆栈的节点的父类从CCLayer更改为CCLayerPanZoom。但当应用程序启动时,我得到的只是一个黑屏。为了使它更干净,我创建了一个新类,从CCLayerPanZoom派生,在init方法中添加了一个测试精灵,并将其推送到AppDelegate.m中的导航堆栈中。我还是什么都没有,只有一个黑屏。以下是我在类中实现的两个方法: @int

为了能够平移和缩放屏幕上的一些内容,我决定使用CCLayerPanZoom扩展。当我查看源代码时,我可以看到它是从CCLayer类派生的。因此,我将推送到导航堆栈的节点的父类从CCLayer更改为CCLayerPanZoom。但当应用程序启动时,我得到的只是一个黑屏。为了使它更干净,我创建了一个新类,从CCLayerPanZoom派生,在init方法中添加了一个测试精灵,并将其推送到AppDelegate.m中的导航堆栈中。我还是什么都没有,只有一个黑屏。以下是我在类中实现的两个方法:

@interface TestPanZoom : CCLayerPanZoom {

}
+(CCScene *) scene;
@end

@implementation TestPanZoom
+(CCScene *) scene
{
    // 'scene' is an autorelease object.
    CCScene *scene = [CCScene node];

    // 'layer' is an autorelease object.
    TestPanZoom *layer = [TestPanZoom node];

    // add layer as a child to scene
    [scene addChild: layer];

    // return the scene
    return scene;
}

-(id)init{
    if(self=[super init])
    {
        CCSprite *sprite=[CCSprite spriteWithFile:@"Default.png"];
        sprite.scale=0.5;
        [self addChild:sprite];
    }
    return self;
}
@end