objective c and cocos2d allocated object managment -
I'm wondering how I would implement the transition between scenes in the best way.
In my app, there is When I am creating a transition from scene 1 to scene 2, there are several allocated examples on the View 1 Init method, that when I revive this scene, I want to be released every time. I'm thinking how I can implement Scene 1 so that all allocated frequencies (and some of them server TCP connected) will not be repeated twice, but only on the first launch, and still during all the visual changes Stay valid. One solution: Set a global flag and set it to 1 on the first launch of the delegate, according to the check it is the first launch on the init method of view 1, and the object Allocates to. / P> When I leave Sequence 1, will this object remain valid when I come back? (To say that I'm not releasing them)? The main goal is to not connect each infection to the server, and keep a representative example on Scenario 1 valid (for example I am using Solution 1) I am looking for a "professional" method to do this. You can use class2 in
ccscene1 in
class1 , and
ccscene2 .
- (id) init {if ((self = [super init])) {socketInstance = [[socket connector light] init]; //just one time ! SocketInstance.delegate = self; // I have the transition later: Scein instead of [[CCCCeter shared director]: [CCTRCsIFFED transcriptionwidth: 0.7f view: [addressbookCisson view]]];
pushScene to run Visual 2. This view will keep 1 completely and keep it in memory then you can continue to
replace with 2 scenes 2, and finally
popScene at scene 1 Can call back.
Comments
Post a Comment