I want to animate the transition of my LevelCompletedVC
.
The LevelCompletedVC
should come from Top to Bottom.
Here is my Code in the 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];
}];
If I want to present the second VC with:
LevelCompletedViewController *lcvc = [self.storyboard instantiateViewControllerWithIdentifier:@"levelCompletedViewController"];
[self presentViewController:lcvc animated:NO completion:nil];
theres no error.
But with my own transition i get:
Unbalanced calls to begin/end appearance transitions for LevelCompletedViewController
.
Whats wrong?
I don't know when or where you present the second VC, but i got same wrong before.
In my case,
presentViewController
are waiting other action done.Try
hope this help you.