![]() |
|
replacing a CCSprite with another: memory leaks? - Printable Version +- iDevGames Forums (http://www.idevgames.com/forums) +-- Forum: Development Zone (/forum-3.html) +--- Forum: Game Programming Fundamentals (/forum-7.html) +--- Thread: replacing a CCSprite with another: memory leaks? (/thread-8711.html) |
replacing a CCSprite with another: memory leaks? - sefiroths - Mar 10, 2011 09:04 AM I have a HellpWorld template. i have a CCNode with a variable: Code: CCSprite *a;//in headerwith an init function Code: a=[CCSprite spriteWithFile:"a.png"];if i want to replace the image with another one using always a. i have a method inside the CCNode that makes: Code: a=[CCSprite spriteWithFile:"b.png"];Code: [a release];so i've tryed: Code: [a setTexture: [[CCTexture2D alloc] initWithImage:[UIImage imageNamed: @"b.png"]];but i don't know how to release the texture before loading another. and why: Code: a=[CCSprite spriteWithFile:"b.png"]thanks RE: replacing a CCSprite with another: memory leaks? - skyhawk - Mar 10, 2011 03:03 PM the CCTextureCache handles the management of releasing and allocating textures. RE: replacing a CCSprite with another: memory leaks? - sefiroths - Mar 11, 2011 08:57 AM thanks i'll try |