【发布时间】:2014-09-24 11:32:29
【问题描述】:
我将UIStoryboardSegue 子类化以执行自定义转场动画。为了使动画可见,我必须将来自目标 ViewController 的视图添加为临时视图。执行动画后,我将删除临时视图并通过 (presentViewController:animated:NO) 呈现最终的 ViewController。
然而,这会导致以下警告:“开始/结束外观转换的不平衡调用”。
如果我保留我的临时视图并且不删除它,则不会出现警告,但最终视图不再响应触摸事件。如何摆脱这个警告?
我的自定义转场代码:
-(void)perform {
UIViewController *sourceViewController = self.sourceViewController;
UIViewController *destinationViewController = self.destinationViewController;
destinationViewController.view.alpha = 0.;
destinationViewController.view.transform = CGAffineTransformScale(destinationViewController.view.transform, 4.0, 4.0);
[sourceViewController.view addSubview:destinationViewController.view];
[UIView animateWithDuration:kSSSpriteKitFadeOutDuration
delay:0.0
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
destinationViewController.view.transform = CGAffineTransformScale(destinationViewController.view.transform, 0.25, 0.25);
destinationViewController.view.alpha = 1.;
}
completion:^(BOOL finished){
[destinationViewController.view removeFromSuperview]; // remove from temp super view
[sourceViewController presentViewController:destinationViewController animated:NO completion:NULL]; // present VC
}];
}
【问题讨论】:
标签: ios objective-c storyboard uistoryboardsegue