如何修复不兼容的指针类型发送?

时间:2014-09-09 07:01:50

标签: ios sprite-kit

SKTextureAtlas *atlas = [SKTextureAtlas atlasNamed:@"Sprites"];
NSString *imageName = [NSString stringWithFormat:@"debri_%ld",(long)randomPiece];  
SKTexture *temp = [atlas textureNamed:imageName];
SKSpriteNode *debris = [SKSpriteNode spriteNodeWithImageNamed:temp]; 
debris.position = position; 
[self addChild:debris];

我收到警告“SKSpriteNode”我不知道如何修复它。

1 个答案:

答案 0 :(得分:2)

方法[SKSpriteNode spriteNodeWithImageNamed:]接受一个字符串参数,该参数导致错误。你想要:

SKSpriteNode *debris = [SKSpriteNode spriteNodeWithTexture:temp];