CCTexture2D* tex = [[CCTextureCache sharedTextureCache] addImage:@"new_image_name"];
[spriteWant2Change setTexture: tex];

what to do if texture is different in size from previous one ?

If the sprites are of different size then you will need to do this after calling setTexture function 

[spriteWant2Change setTextureRect:CGRectMake(0, 0, tex.contentSize.width, tex.contentSize.height)];

摘自:Stack Overflow

相关文章:

  • 2022-03-10
  • 2022-12-23
  • 2021-05-22
  • 2021-11-06
  • 2021-12-17
  • 2022-01-22
  • 2022-12-23
  • 2022-01-02
猜你喜欢
  • 2021-04-19
  • 2022-12-23
  • 2021-08-01
  • 2021-10-13
  • 2022-12-23
  • 2021-05-24
  • 2021-05-01
相关资源
相似解决方案