pushScene and popScene or replaceScene . which should we use and when ?

Posted by srikanth rongali on Stack Overflow See other posts from Stack Overflow or by srikanth rongali
Published on 2010-05-27T09:39:13Z Indexed on 2010/05/27 9:41 UTC
Read the original article Hit count: 278

Filed under:
|

I am using push scene to get the next scene. But, I read that for each PushScene the scene is stored in stack. The memory usage is more. So, I am using the replaceScene in place of pushScene. But, with replace scene I am getting the memory-bad-access message in debugger.

So, I want to popScene after using it, so that the retain count is zero. But, I am confused in using popScene. If I have a Scene1 and Scene2. I used the following to go in to Scene2. Now I need to remove Scene1 from stack.

[[CCDirector sharedDirector] pushScene:Scene2];  

Where should I write the popScene to popScene1. How to get the previous scene in current running scene ? Thank you/

© Stack Overflow or respective owner

Related posts about cocoa-touch

Related posts about cocos2d-iphone