我在一个rootview上的按钮的对应事件中 添加了一个subview 用的是导航栏的pushview方法
这个subview是用来演示动画的 其中动画用的是COCOS2D库德一些特效  但是当我在subview上的按钮上点击返回
触发对应事件时 我用的是 removefromsuperview  但是就死在这儿 不知道为什么 是还有资源没有释放干净吗?father view中对应的添加subview的代码如下:
pptPlayView *pptv = [[pptPlayView alloc]initWithNibName:@"pptPlayView" bundle:nil];
[self.navigationController pushViewController:pptv animated:YES];
[pptv release];subview初始化的代码:
        self.view = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
SceFlag = 0;
[CCDirector setDirectorType:kCCDirectorTypeDefault];


CCDirector *director = [CCDirector sharedDirector];
self.wantsFullScreenLayout = YES;

//
// Create the EAGLView manually
//  1. Create a RGB565 format. Alternative: RGBA8
// 2. depth format of 0 bit. Use 16 or 24 bit for 3d effects, like CCPageTurnTransition
//
//
/*
 int d = [window bounds].size.height;
 int a = [window bounds].origin.x;
 int b = [window frame].size.height;*/
//int c = [window bounds].origin.x;
EAGLView *glView = [EAGLView viewWithFrame:[self.view bounds]
   pixelFormat:kEAGLColorFormatRGBA8//kEAGLColorFormatRGB565 // kEAGLColorFormatRGBA8
   depthFormat:0 // GL_DEPTH_COMPONENT16_OES
preserveBackbuffer:NO];

[director setOpenGLView:glView];

#if GAME_AUTOROTATION == kGameAutorotationUIViewController
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
#else
[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
#endif

[director setAnimationInterval:1.0/60];
[director setDisplayFPS:YES];

[self setView:glView];

// make the View Controller a child of the main window
//[window addSubview: viewController.view];

//[window makeKeyAndVisible];

// Default texture format for PNG/BMP/TIFF/JPEG/GIF images
// It can be RGBA8888, RGBA4444, RGB5_A1, RGB565
// You can change anytime.
[CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];
[[CCDirector sharedDirector] runWithScene: [HelloWorld scene]];

ppt = [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(play) userInfo:nil repeats:YES];
    
//add a button on the scene and define the action when touch the button
//UIButton *versionButton = [UIButton buttonWithType:UIButtonTypeInfoDark];
versionButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];

[versionButton setFrame:CGRectMake(0.0f, 0.0f, 100.0f,40.0f)];

[versionButton addTarget:self action:@selector(pressedPausePpt:) forControlEvents:UIControlEventTouchUpInside];
[[[CCDirector sharedDirector] openGLView] addSubview: versionButton]; 
//[self.view addSubview:versionButton];

[versionButton setTitle:@"Pause Play" forState:UIControlStateNormal];
UIFont *btFont = [UIFont fontWithName:@"Arial" size:15];
versionButton.font = btFont;
[versionButton setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];

[super viewDidLoad];
我在其中使用定时器不断切换场景来达到动画效果  定时器对应方法如下:
-(void)play{
if(SceFlag == 0)
{


CCScene *sc = [CCScene node];
[sc addChild:[HelloWorld scene]];
[[CCDirector sharedDirector] replaceScene:[CCTransitionMoveInB transitionWithDuration:1.0  scene:sc]];
SceFlag++;
return;
}
if(SceFlag == 1)
{

CCScene *sc = [CCScene node];
[sc addChild:[HelloWorld scene]];
[[CCDirector sharedDirector] replaceScene:[CCTransitionMoveInR transitionWithDuration:1.0  scene:sc]];
SceFlag++;
return;
}
if(SceFlag == 2)
{

CCScene *sc = [CCScene node];
[sc addChild:[HelloWorld scene]];
[[CCDirector sharedDirector] replaceScene:[CCTransitionSplitRows transitionWithDuration:1.0  scene:sc]];
SceFlag++;
return;
}
if(SceFlag == 3)
{

CCScene *sc = [CCScene node];
[sc addChild:[HelloWorld scene]];
[[CCDirector sharedDirector] replaceScene:[CCTransitionMoveInT transitionWithDuration:1.0  scene:sc]];
SceFlag++;
return;
}
if(SceFlag == 4)
{

CCScene *sc = [CCScene node];
[sc addChild:[HelloWorld scene]];
[[CCDirector sharedDirector] replaceScene:[CCTransitionSlideInL transitionWithDuration:1.0  scene:sc]];
SceFlag++;
return;
}
if(SceFlag >= 5)
{

CCScene *sc = [CCScene node];
[sc addChild:[HelloWorld scene]];
[[CCDirector sharedDirector] replaceScene:[CCTransitionFlipY transitionWithDuration:1.0  scene:sc]];
SceFlag = 0;
return;
}
}然后我在对应的按钮事件方法中定义如下  想返回导航栏:         [ppt invalidate];
[[CCDirector sharedDirector] pause];
CCDirector *director = [CCDirector sharedDirector];
[[director openGLView] removeFromSuperview];
[director end];
 [self.navigationController popViewControllerAnimated:YES];但是经常死在这 不知道要终止还需要做什么  求给位大虾莫嫌分少  帮帮小菜