willMoveToParentViewController&&didMoveToParentViewController (iOS monitor system sliding return event)

Both methods will be called when the first push comes in, and the parent value is not empty. When you start to use the system side sliding, willMove is called first, and the parent value is empty; when the sliding ends and returns to the previous page, didMove is called, and the parent value is also empty. If the sliding is not over, the previous page is not returned, that is If you still return to the current page with a slight stroke, the didMove method will not be called. So if you want to do some operations on the previous page after sliding back, you can judge based on the value of parent in the didMove method.

-(void)willMoveToParentViewController:(UIViewController *)parent{
    [super willMoveToParentViewController:parent];
}

- (void)didMoveToParentViewController:(UIViewController *)parent{
    [super didMoveToParentViewController:parent];
    if(parent == nil){
    }
}

Guess you like

Origin blog.csdn.net/qq_28285625/article/details/112190936