Cocos2d之前的场景[自我安排]并没有停止运行!在替换另一个场景时应该如此

时间:2012-03-23 10:05:18

标签: cocos2d-iphone scene

我正在使用Chaos In Motion在http://www.chaosinmotion.com/flowcover.html使用cocos2d在ios中创建基于coverflow的应用程序,我正在使用    [[ccdirector sharedirector] pushscene:[myscene scene]];

它显示了paricular控件,它有一个使用[self schedule:]运行的更新方法,然后我弹出场景并返回到之前出现的屏幕,但之前的场景计划仍在运行,我无法按当前屏幕上的任何按钮。我坚持不懈。

我正在使用[[CCDirector sharedDirector] pushScene:[CCTransitionFadeBL transitionWithDuration:3 scene:[AvatarSelection scene]]];为了推动场景和在头像选择类中,我有一个名为

的方法

** - (void)ShowCoverFlow {     FlowCoverViewController * flowCover;     flowCoverView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

//using a navigation controller to present FlowCover without it rotating to portrait
testViewController = [[UINavigationController alloc] init];

//The navigation controller will try to put a nav bar in the window, so we hide it
[testViewController setNavigationBarHidden:YES animated:NO];

[testViewController setView:flowCoverView];

NSArray *array = [[NSBundle mainBundle] loadNibNamed:@"TestFC" owner:self options:nil];
flowCover = [array objectAtIndex:0];
testViewController.delegate = self;
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
[[[[CCDirector sharedDirector] openGLView] window]addSubview:flowCoverView];
//testViewController.view.backgroundColor = [UIColor redColor];

double delayInSeconds = 0.1;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
    [testViewController presentModalViewController:flowCover animated:YES];
});



[testViewController  setModalPresentationStyle:UIModalPresentationFullScreen];

} **

然后选择封面流程后我将删除剩余的 ** - (void)flowCover:(FlowCoverView *)视图didSelect:(int)图像 {

[flowCoverView removeFromSuperview];

    [testViewController dismissModalViewControllerAnimated:YES];
    [testViewController release];
    testViewController = nil;
  [[CCDirector sharedDirector] popScene];
[[NSNotificationCenter defaultCenter] postNotificationName:@"avatarchanged" object:self];

} **

并且在弹出前一个屏幕中没有任何按钮后,我已启用

0 个答案:

没有答案