0

I have created a custom segue to create vertical slide animation. It was working fine in iOS7. But it is giving warning and flickering effect at the end of the animation.

Warning Message: Unbalanced calls to begin/end appearance transitions for destinationViewController

Following is my code

-(void)perform{

    NSTimeInterval delayinterval = 0.0;

    UIViewController *sourceViewController = self.sourceViewController;
    UIViewController *destinationViewController = self.destinationViewController;

    destinationViewController.view.center    = sourceViewController.view.center;
    destinationViewController.view.transform = sourceViewController.view.transform;
    destinationViewController.view.bounds    = sourceViewController.view.bounds;

    CGRect destination = destinationViewController.view.frame;
    destinationViewController.view.frame = CGRectMake(destination.origin.x, destination.size.height, destination.size.width, destination.size.height);

    [sourceViewController.view.superview addSubview:destinationViewController.view];

    [UIView animateWithDuration:0.2 delay:delayinterval options:UIViewAnimationOptionTransitionNone animations:^{

        CGRect orginator = sourceViewController.view.frame;
        sourceViewController.view.frame = CGRectMake(orginator.origin.x, -orginator.size.height, orginator.size.width, orginator.size.height);
        destinationViewController.view.frame = orginator;

    } completion:^(BOOL finished) {

        // remove from temp super view
        [destinationViewController.view removeFromSuperview];

          if ([self.identifier isEqualToString:@"UnWindCustomSettingsSegue"]){
              [sourceViewController dismissViewControllerAnimated:NO completion:NULL];
          }else {
              [sourceViewController presentViewController:destinationViewController animated:NO completion:NULL];
          }

    }];

}
Ran
  • 27
  • 1
  • 3

1 Answers1

0

Take a look at the accepted answer from this post SO post: Unbalanced calls when performing a custom segue

The OP in that question fixed the flickering by adding a screenshot of the view that is being removed. Also, the accepted answer explains whey you're getting the warning.

Community
  • 1
  • 1
Austen Chongpison
  • 3,966
  • 1
  • 20
  • 17
  • 1
    Thanks for your timely reply. Sorry for the delay in responding. The solution in the other thread has helped in removing the warning message. But still I'm confused with the solution to remove the flickering. – Ran Sep 30 '14 at 13:43