0

我正在开发一个应用程序,但是当我从第一个视图切换到第二个视图(游戏级别)时。游戏中断:

@autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }

并带有警报威胁 1:信号 SIGABRT。

我不知道为什么,在我的其他视图中,这段代码可以工作,但是当我想切换到这个视图时,它就崩溃了。我的切换代码是:

-(void)collision {

if (CGRectIntersectsRect(Redsquare.frame, Invisible.frame)) {
        Level2 *switchtosecondlevelchapter1 = [[Level2 alloc] initWithNibName:nil bundle:nil];

        [self presentModalViewController:switchtosecondlevelchapter1 animated:YES];
    }
}

我希望你能帮助我,我是新手。先谢谢了!

4

1 回答 1

1

Is your nib name for Level2 literally "Level2"... in that case you can provide nil to initWithNibName: But also add break points and NSLog to debug and see where it is last called... for example you're literal presentModalViewController: code might be fine.... but your CGRectIntersectsRect might be... off.... Is everything initialized/non-zero Look at these different factors and reply as comment

于 2012-04-13T14:42:04.633 回答