原文链接: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];
知识共享授权条款
本著作Chen, Zai-Chun制作,以知识共享 姓名标示-相同方式分享 4.0 国际 授权条款释出

留言

Jul 13 2011