Search code examples
iossegueuiviewanimationtransition

Seeing a flicker mid-transition?


I just tried my making a custom transition between view controllers. It basically spins the next one into view, and it works. Except that the source view controller flickers briefly back into visibility right as the animation completes, just as the destination view controller achieves its final position.

I'm also getting a warning about Unbalanced calls to begin/end appearance transitions which I'm still working on fixing-- I don't know if they're related.

Does anyone see anything here that jumps out as not quite right that would cause a flicker?

I then just assigned a button to do a custom segue via storyboard editor.

-(void)perform
{
    UIViewController *source = self.sourceViewController;
    UIViewController *destination = self.destinationViewController;

    [source.view addSubview:destination.view];
    destination.view.transform = CGAffineTransformMakeRotation(M_PI / 2);

    [UIView animateWithDuration:0.5 delay:0.0 options:UIViewAnimationCurveEaseInOut animations:^{
        destination.view.transform = CGAffineTransformMakeRotation(0);
    }completion:^(BOOL finished){
        [destination.view removeFromSuperview];
        [source presentViewController:destination animated:NO completion:NULL];
    }];
}

Solution

  • Take out the removeFromSuperview.