isBeingDismissed not set in viewWillDisappear:

前端 未结 5 1389
独厮守ぢ
独厮守ぢ 2021-02-13 12:25

I have some code to clean up in my viewWillDisappear:, which I only want to use when the view is moving back to the parent view controller.

- (void)         


        
5条回答
  •  失恋的感觉
    2021-02-13 13:13

            viewController.isBeingPresented == NO;
            [rootVC presentViewController:viewController animated:NO completion:^{
                viewController.isBeingPresented == NO;
                viewController.isBeingDismissed == NO;
                [viewController dismissViewControllerAnimated:NO completion:^{
                    viewController.isBeingDismissed == NO;
                }];
                viewController.isBeingDismissed == NO;    // is not work
            }];
            viewController.isBeingPresented == YES;     // is work
    
            viewController.isBeingPresented == NO;
            [rootVC presentViewController:viewController animated:NO completion:^{
                viewController.isBeingPresented == NO;
                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                    viewController.isBeingDismissed == NO;
                    [viewController dismissViewControllerAnimated:NO completion:^{
                        viewController.isBeingDismissed == NO;
                    }];
                    viewController.isBeingDismissed == YES;    // is work
                });
            }];
            viewController.isBeingPresented == YES;     // is work
    

提交回复
热议问题