Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to prevent view from "flashing" at the end of a custom UIStoryboardSegue?
    primarykey
    data
    text
    <p>I have written a custom <code>UIStoryboardSegue</code> which I'm using to transition between various <code>UIViewControllers</code>. The animations work as desired, and much of the time the <code>UIStoryboardSegue</code> displays as I'd expected both in the simulator and on the device.</p> <p>However, sometimes after the segue completes, I can see the old <code>UIViewController</code> <strong>flash</strong> for a fraction of a second after the <code>UIStoryboardSegue</code> completes. The result disrupts the smooth transition I am expecting. Unfortunately, I can't discern any pattern for this behaviour.</p> <p>I've included a barebones version of the approach I'm using to manage the segue below. Is there a more reliable method to insure smooth transitions? Am I doing something wrong? Again, much of the time the segue looks just the way I want.</p> <pre><code>- (void)perform { self.window = [[[UIApplication sharedApplication] delegate] window]; UIViewController *source = (UIViewController *) self.sourceViewController; UIViewController *dest = (UIViewController *) self.destinationViewController; [self.window insertSubview:dest.view.window belowSubview:source.view]; self.segueLayer = [CALayer layer]; // Create and add a number of other CALayers for displaying the segue, // adding them to the base segueLayer // Create and add CAAnimations for animating the CALayers // (code omitted for the sake of space) [self.window addSubview:dest.view]; [self.window.layer addSublayer:self.segueLayer]; [source.view removeFromSuperview]; } - (void)animationDidStop:(CAAnimation *)animation finished:(BOOL)isFinished { UIViewController *source = (UIViewController *) self.sourceViewController; UIViewController *dest = (UIViewController *) self.destinationViewController; if (isFinished) { // Remove and deallocate the CALayers previously created [self.segueLayer removeFromSuperlayer]; self.segueLayer = nil; self.window.rootViewController = dest; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload