【发布时间】:2014-11-19 09:11:06
【问题描述】:
我试图通过使用自定义 segue 并实现 segue 类来实现自定义过渡样式以淡入新的 Viewcontroller。 我几乎设法实现了这一点,但每次运行应用程序时都会收到警告/错误:
“开始/结束外观转换的不平衡调用。”
虽然应用程序一直运行良好,但动画期间还是有一点闪烁。
这是我的代码:
@implementation BlurredFadeSague
- (void)perform{
UIViewController *sourceViewController = self.sourceViewController;
UIViewController *destinationViewController = self.destinationViewController;
[sourceViewController.view addSubview:destinationViewController.view];
destinationViewController.view.alpha = 0.0f;
[UIView animateWithDuration:0.5f
delay:0.1f
options:UIViewAnimationOptionCurveLinear
animations:^{
destinationViewController.view.alpha = 1.0;
}
completion:^(BOOL finished){
[destinationViewController.view removeFromSuperview];
[sourceViewController presentViewController:destinationViewController animated:NO completion:NULL];
}];
}
@end
我将转换形式称为 IBAction,如下所示:
[self performSegueWithIdentifier:@"blurred" sender:self];
但是我得到了 consol 警告/错误:
Unbalanced calls to begin/end appearance transitions for
<DeviceControlViewController: 0x17597050>.
很高兴得到任何帮助, 最好的 vinc。
【问题讨论】:
-
我不知道你是否还在为这个问题而苦恼,但我猜你会得到这个错误,因为你没有告诉 UIKit 你正在移动视图控制器。当视图控制器移动到其他窗口或父视图控制器时,您应该使用
willMoveToParentViewController:或willMoveToWindow:向视图控制器声明,使用nil指示它何时被移除。
标签: xcode segue xcode6 uiviewanimation uiviewanimationtransition