iosobjective-cuiviewcontrollercustom-transition

Custom transition for push and standard transition for pop


I have a View Controller that has a custom push transition when a table cell is tapped and performs the standard pop transition when the back bar button item is tapped. The problem is when I try to go to the same view controller from the previous controller, the app crashes. Below is the UINavigationControllerDelegatefunction I'm implementing:

- (id<UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC
{
    return (operation == UINavigationControllerOperationPush ? animator : nil);
}

Any clue is appreciated!

Thanks in advance.


Solution

  • I had a problem, where the NavigationController's delegate was set to a view controller that had been deallocated, which caused a crash in [UINavigationController _customTransitionController:].

    Especially when using unwind segues, it does NOT seem that any intermediate view controllers receive a viewWillDisappear callback before getting deallocated. The remedy here is to implement the following in the destination unwind view controller:

    -(IBAction)unwindSegue:(UIStoryboardSegue*)segue{
        self.navigationController.delegate = nil;
    }