views:

224

answers:

1

I'am trying to make the following code work but I only see white rectangles when rendering them :S;

CCSprite *tempSprite = [[CCSprite spriteWithTexture:[[CCTextureCache sharedTextureCache] addImage:@"Icon.png"]] retain];

TapCircle *tapObject = [[TapCircle alloc] initWithSprite:tempSprite];

The TapCircle class is a subclass of TapElement which in turn is a subclass of CCNode. The initWithSprite code in TapCircle:

- (id) initWithSprite:(CCSprite*)tex {

    if ((self = [super init]) == nil) return nil;

    [self addChild:tex];

    return self;
}

The TapCircle object is then added to a parent CCNode which in turn is added to the layer being rendered. I have tested creating the tempsprite in another projekt where I added it directly to the layer and it worked... So must be some kind of parent-child-problem?

+1  A: 

Did you add the Icon.png as project resource? Also, shouldn't you be deriving from CCSprite?

zooropa