次のコードを機能させようとしていますが、レンダリング時に白い長方形しか表示されません:S;
CCSprite *tempSprite = [[CCSprite spriteWithTexture:[[CCTextureCache sharedTextureCache] addImage:@"Icon.png"]] retain];
TapCircle *tapObject = [[TapCircle alloc] initWithSprite:tempSprite];
TapCircleクラスはTapElementのサブクラスであり、TapElementはCCNodeのサブクラスです。TapCircleのinitWithSpriteコード:
- (id) initWithSprite:(CCSprite*)tex {
if ((self = [super init]) == nil) return nil;
[self addChild:tex];
return self;
}
次に、TapCircleオブジェクトが親CCNodeに追加され、親CCNodeがレンダリングされるレイヤーに追加されます。別のプロジェクトでテンプスプライトを作成することをテストしました。ここで、テンプスプライトをレイヤーに直接追加しましたが、機能しました...では、ある種の親子の問題が必要ですか?