Article From:https://segmentfault.com/q/1010000012149652
Question:

As a problem

I have three pages: A, B, C, A present to B, B present to C, but when C dismiss arrives at C, the flash will flash. How do I eliminate it?
This is my dismiss Code:

 -(void)dismiss 
    {
        UIViewController *vc = self;
         while (![vc isKindOfClass:[BViewController class]]) {
            vc = vc.presentingViewController;
         }
         if (vc.presentingViewController)
         {
             vc = vc.presentingViewController;
         }
         [vc dismissViewControllerAnimated:NO completion:^{
          // do something
         }];
    }

Answer 0:
  1. -> A It must be dismiss from C-> B B-> A. It should be the problem to flicker. Personal suggestion B can have navCon, then push to C, C to dismiss.
Answer 1:
  1. dismiss To A, you’re reading B, C and dimiss.

But you want to see only the animation of C dismiss.
Before you start dismiss C, let B first dismiss (with animation parameters set to false).
And then dismiss C

Answer 2:

Direct back to the root controller:

/** Back to the root controller * /- (void) dismissToRootViewController{UIViewController *vc = self;While (vc.presenTingViewController) {VC = vc.presentingViewController;}[vc dismissViewControllerANimated:YES completion:nil];}

Fixed back and back two pages:


[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];

This way?

Answer 3:

@White Dragon

That’s what I do

-(void)dismiss 
{
    UIViewController *vc = self;
     while (![vc isKindOfClass:[BViewController class]]) {
        vc = vc.presentingViewController;
     }
     if (vc.presentingViewController)
     {
         vc = vc.presentingViewController;
     }
     [vc dismissViewControllerAnimated:NO completion:^{
      // do something
     }];
}

But it will still flash, but it is not necessary. When the App is first launched, the B page will flash, especially on iOS 11.

Leave a Reply

Your email address will not be published. Required fields are marked *