(Already asked on StackOverflow, but might as well cover my bases here as well.)

I have a view controller navigation hierarchy where only the top view 
controller has its navigation bar hidden. Normal pushing/popping is fine and 
works as expected. However, when the pop is interactive (drag-to-pop), the top 
opaque bar doesn't disappear until the transition is finished. I've implemented 
the logic in the following delegate call:

- (void)navigationController:(UINavigationController *)navigationController 
willShowViewController:(UIViewController *)viewController 
animated:(BOOL)animated {

    if( [viewController isKindOfClass:[MyTopViewController class]] == YES ) {

        id<UIViewControllerTransitionCoordinator> transitionCoordinator = 
viewController.transitionCoordinator;

        if( transitionCoordinator != nil && 
transitionCoordinator.initiallyInteractive == YES ) {
            [transitionCoordinator 
notifyWhenInteractionEndsUsingBlock:^(id<UIViewControllerTransitionCoordinatorContext>
  _Nonnull context) {

                if( context.isCancelled == YES ) {
                    return;
                }

                [navigationController setNavigationBarHidden:YES 
animated:animated];
            }];
        } else {
            [navigationController setNavigationBarHidden:YES animated:animated];
        }

    } else {
        [navigationController setNavigationBarHidden:NO animated:animated];
    }
}

I've already attempted numerous variations of this, but each one has had 
various issues with interactive transitions, especially if the transition is 
canceled mid-way. What's the best way to approach this?
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to