From 7bc26a8e46703d484f623c7b88611dbd6405a077 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 14 Oct 2021 12:36:04 -0500 Subject: [PATCH] implemented delegate callbacks for prepareForDisplay Signed-off-by: Matt Bruce --- .../MVMCoreNavigationOperation.m | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m index b700005..5865ebf 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m +++ b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationOperation.m @@ -213,12 +213,14 @@ - (void)pushViewController { // Although the post animation state is currently fine with push, store anyway as a precaution self.futureViewControllers = [self.navigationObject.navigationController.viewControllers arrayByAddingObject:self.navigationObject.viewController]; + [self navigationController:self.navigationObject.navigationController prepareDisplayForViewController:self.navigationObject.viewController]; [self.navigationObject.navigationController pushViewController:self.navigationObject.viewController animated:self.navigationObject.animated]; } - (void)setViewControllers:(NSArray *)viewControllers { self.futureViewControllers = viewControllers; if (![self.navigationObject.navigationController.viewControllers isEqualToArray:viewControllers]) { + [self navigationController:self.navigationObject.navigationController prepareDisplayForViewController:viewControllers.lastObject]; [self.navigationObject.navigationController setViewControllers:viewControllers animated:self.navigationObject.animated]; } else { @@ -227,6 +229,21 @@ } } +- (void) navigationController:(UINavigationController *)navigationController prepareDisplayForViewController:(UIViewController *)viewController{ + + if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:prepareDisplayForViewController:)]) { + [self.delegate navigationController:navigationController + prepareDisplayForViewController:viewController]; + } + + for (NSObject *delegate in [MVMCoreNavigationHandler sharedNavigationHandler].delegates.allObjects) { + if (delegate && [delegate respondsToSelector:@selector(navigationController:prepareDisplayForViewController:)]) { + [delegate navigationController:navigationController + prepareDisplayForViewController:viewController]; + } + } +} + - (void)markAsFinished { self.navigationObject.navigationController.delegate = nil; if (self.navigationObject.stopLoadingOverlay) { @@ -241,7 +258,6 @@ } #pragma mark - Delegate - - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { if (self.navigationObject.stopLoadingOverlay) { [[MVMCoreLoadingOverlayHandler sharedLoadingOverlay] stopLoading:YES];