0

G'day,

I have a small question. I'd like to use ccsequence for replacing current running scene with another one just after the view controller will be dismissed, would be nice to have something like that:

id test = [((AppController *) [UIApplication sharedApplication].delegate).navController dismissViewControllerAnimated:YES completion:Nil];

(id "test" for future use in ccsequence)

So here is the question, is it possible anyway to use ccsequence for dismissing view controller using the string typed above and then replacing current running scene with another one (just wanna repeat), but only after the view controller will be dismissed, because it couses some problems with animation on devices like iphone 4 if i am trying to dismiss view controller and replaceScene in the same time without making it successively.

Thank you very much in advance guys for your answers and very hope to get some help here!

2 Answers2

0

the replaceScene method of CCDirector 'returns' void. You probably want to use the following CCNode method to dismiss your controller

-(void)onExitTransitionDidStart {

}
YvesLeBorg
  • 9,070
  • 8
  • 35
  • 48
  • Thank you for the fast answer! Why i need it, it works pretty slow at least on iphone 4 if i am trying to dismiss modal view controller and then replace scene, everything i want is to make these actions in ccsequence, at first dismiss view controller and once it will be dismissed replace scene.. – user2228868 Apr 29 '13 at 06:43
  • .. I have these strings: [((AppController*) [UIApplication sharedApplication].delegate).navController dismissModalViewControllerAnimated:YES]; and [[CCDirector sharedDirector] replaceScene:[CCTransitionSlideInL transitionWithDuration:0.4f scene:[HelloWorldLayer scene]]]; They both are in 'imagePickerController', i'd like to have a sequence of actions where i could execute one action after another: dismiss view controller; replace scene. that's it. Thank you! – user2228868 Apr 29 '13 at 06:43
0

So i am answering the question i've asked self previously, here we go (tested on iPhone 4, IOS 5.1.1, fully workable example):

[((AppController *) [UIApplication sharedApplication].delegate).navController dismissViewControllerAnimated:YES completion:^{ [[CCDirector sharedDirector] replaceScene:[CCTransitionSlideInL transitionWithDuration:0.4f scene:[HelloWorldLayer scene]]]; }];

You can change parameters of course like duration or scene etc, anyway it waits till view controller will be dismissed and once it is, replace the current running scene with another one. This way animation looks way better on not really powerful devices like iphone 4 is. Hope it helps somebody, cuz i've spent few days to find an answer on such a simple question.