0

im trying to implement a custom transition-style to fade in a new Viewcontroller by using a custom segue and implementing a segue class. I almost manages to implement this but every time i run the application i get the warning/error:

"Unbalanced calls to begin/end appearance transitions for ."

although the applications keeps running just fine there is a little flickering during the animation.

here is my code:

    @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

and i call the transition form a IBAction like this:

 [self performSegueWithIdentifier:@"blurred" sender:self];

however i get the consol warning/error :

 Unbalanced calls to begin/end appearance transitions for
 <DeviceControlViewController: 0x17597050>.

Would be very pleased for any help, best vinc.

  • I don't know if you still struggle with this issue, but I'm guessing you get this error because you don't tell UIKit that you are moving viewcontrollers. When viewcontrollers move to other windows or parentviewcontrollers, you should announce that to the viewcontroller with [`willMoveToParentViewController:`](http://apple.co/1VPJEqM) or [`willMoveToWindow:`](http://apple.co/1Mr2qDx), using `nil` to indicate when it's being removed. – vrwim Apr 12 '16 at 07:17

1 Answers1

0

You mentioned that you called the segue from a button action. Do you also have the segue tied to that button? If so, you may be calling the segue twice. This results in the second call being done prior to the first finishing and thus the 'unbalancing'.

MobileVet
  • 2,958
  • 2
  • 26
  • 42