更改ViewControllers时的线程1:EXC_BAD_ACCESS

时间:2012-07-30 15:13:19

标签: objective-c ios

我需要机会我的ViewControllers,所以我使用了这个函数:

(void)pushViewFromRight:(UIViewController*)coming over:(UIViewController*)going {
    CGRect frameComing = coming.view.frame;
    CGRect frameGoing = going.view.frame;
    frameComing.origin.x = 0;
    frameComing.origin.y = -460;
    coming.view.frame = frameComing;
    if ([coming.view superview] == nil)
        [SlideContainer addSubview:coming.view];

    [UIView beginAnimations:@"frame" context:nil];
    [UIView setAnimationDuration:1];

    [coming viewWillAppear:YES];
    [going viewWillAppear:YES];
    frameComing.origin.y = 0;
    coming.view.frame = frameComing;
    going.view.frame = frameGoing;
    [going viewDidDisappear:YES];
    [coming viewDidAppear:YES];

    [UIView commitAnimations];

}

在第二个ViewController上,我创建了一个返回的按钮。 但是当我想要返回时,(即使按下按钮后没有动作),它也会与EXC_BAD_ACCESS崩溃。 为什么会这样?

0 个答案:

没有答案