我创建了一个自定义转场:
-(void)perform{
UIViewController *destination = [self destinationViewController];
UIViewController *source = [self sourceViewController];
[source.view addSubview:destination.view];
CGRect destionationFrame = destination.view.frame;
CGRect sourceFrame = source.view.frame;
CGSize sourceSize = CGSizeMake(sourceFrame.size.height, sourceFrame.size.width);
destination.view.frame = CGRectMake(sourceSize.width,0,destionationFrame.size.width,destionationFrame.size.height);
[UIView animateWithDuration:0.3
delay:0
options:UIViewAnimationCurveEaseInOut | UIViewAnimationOptionBeginFromCurrentState
animations:^{
destination.view.frame = CGRectMake(sourceSize.width-destionationFrame.size.width,0,destionationFrame.size.width,destionationFrame.size.height);
} completion:^(BOOL finished) {
//[source presentModalViewController:destination animated:NO completion:nil];
//[source presentModalViewController:destination animated:NO];
}];
}
问题是,如果我在动画完成时不执行任何操作,触摸目标 Controller 的任何控件都会导致应用程序崩溃。
如果我制作一个presentModalViewController,则会导致屏幕上的任何对象做出响应。
有什么帮助吗?谢谢
最佳答案
既然你这样做了:
[source.view addSubview:destination.view];
您首先需要执行以下操作:
[源addChildViewController:目标];
但不确定它是否能解决您的问题。
关于ios - 自定义转场崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16609050/