不平衡调用 ViewController 具有自己的转换

Unbalanced calls for ViewController with own transition

我想为 LevelCompletedVC 的过渡设置动画。 LevelCompletedVC 应该从上到下。

这是我在 GameViewController 中的代码:

LevelCompletedViewController *lcvc = [self.storyboard instantiateViewControllerWithIdentifier:@"levelCompletedViewController"];

[self.view addSubview:lcvc.view];
[lcvc.view setFrame:self.view.window.frame];
[lcvc.view setTransform:CGAffineTransformMakeTranslation(0, -self.view.frame.size.height)];
[lcvc.view setAlpha:1.0];

[UIView animateWithDuration:0.7 delay:0.0 options : UIViewAnimationOptionTransitionFlipFromTop
           animations:^{
                    [lcvc.view setTransform : CGAffineTransformMakeTranslation(0, 0)];
                    [lcvc.view setAlpha:1.0];
           }
           completion:^(BOOL finished) {
                     [lcvc.view removeFromSuperview];
                     [self presentViewController:lcvc animated:NO completion:nil];
       }];

如果我想将第二个 VC 呈现为:

LevelCompletedViewController *lcvc = [self.storyboard instantiateViewControllerWithIdentifier:@"levelCompletedViewController"];


[self presentViewController:lcvc animated:NO completion:nil];

没有错误。

但是通过我自己的转换我得到:

LevelCompletedViewController 对 begin/end 外观转换的不平衡调用。

怎么了?

我不知道你何时何地展示第二个 VC,但我也一样 之前错了

就我而言,presentViewController 正在等待其他操作完成。

尝试

dispatch_async(dispatch_get_main_queue(), ^(void){     
    LevelCompletedViewController *lcvc = [self.storyboard instantiateViewControllerWithIdentifier:@"levelCompletedViewController"];
    [self presentViewController:lcvc animated:NO completion:nil];
});

希望对您有所帮助。