我需要碰碰我的 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 而崩溃。为什么会这样?