title: Custom Segue Flashes
body: <p>I am using the following code to override the perform method in a custom segue to achieve sliding effect when moving between view controllers.</p>
  
  <pre><code>- (void)perform
  {
      MasterController *sourceController = (MasterController *)self.sourceViewController;
      MasterController *destinationController = (MasterController *)self.destinationViewController;
  
      CGRect frame = sourceController.view.frame;
  
      [sourceController.view addSubview:destinationController.view];
      [destinationController.view setFrame:CGRectOffset(frame, frame.size.width, 0)];
  
      [UIView animateWithDuration:0.5 animations:^{
  
          [sourceController.view setFrame:CGRectOffset(frame, -frame.size.width, 0)];
  
      } completion:^(BOOL finished) {
  
          [sourceController presentViewController:destinationController animated:NO completion:nil];
          [destinationController.view removeFromSuperview];
  
      }];
  }
  </code></pre>
  
  <p>Similar to this code exists all over the internet. the problem is that "sometimes" after the animation finish the screen flashes/blinks/flickers then gets back normal.</p>
  
  <p>removing <code>[destinationController.view removeFromSuperview];</code> line of code seems to solve the problem. but, that doesn't look right! right?</p>
  
  <p>Any ideas how to solve this?</p>