【注意】最后更新于 July 13, 2011,文中内容可能已过时,请谨慎使用。
原文链接:http://www.cocos2d-iphone.org/forum/topic/1076
在CCDirector.h添加
1
| - (void) popSceneWithTransition: (Class)c duration:(ccTime)t;
|
在CCDirector.m中添加
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| -(void) popSceneWithTransition: (Class)transitionClass duration:(ccTime)t;
{
NSAssert( runningScene_ != nil, @"A running Scene is needed");
[scenesStack_ removeLastObject];
NSUInteger c = [scenesStack_ count];
if( c == 0 ) {
[self end];
} else {
CCScene* scene = [transitionClass transitionWithDuration:t scene:[scenesStack_ objectAtIndex:c-1]];
[scenesStack_ replaceObjectAtIndex:c-1 withObject:scene];
nextScene_ = scene;
}
}
|
调用方式
1
| [[CCDirector sharedDirector] popSceneWithTransition:[CCSlideInRTransition class] duration:0.5f];
|