UINavigationController back button not animating

2019-02-22 03:55发布

问题:

I'm having a weird issue with a navigation controller's back button animation:

my app has a tab bar control with 3 tabs, one of them has a navigation controller with two subsequent view controllers, the first one just show a master table and the second one details, the problem comes when I tap the back button from the detail view controller, instead of slide back to the master view controller it just pops the view without animation.

I've noticed that if I first go to another tab, and then return again to this one, the animation will trigger normally.

I've rebuilt the whole app navigation from scratch but the problem still persist, any help is appreciated.

Thanks in advance!.

Edit: More info added

This is how my storyboard looks like in that particular branch:

Here's the prepareForSegue from "Partidos Activos" view controller:

#pragma mark - Segues

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    if ([segue.identifier isEqualToString:@"PartidosEnDia"]) {
        PartidosActivosEnFecha *paf = segue.destinationViewController;
        CalendarCell *senderCell = (CalendarCell *)sender;
        paf.datos = senderCell.dataDic;
    }
}

Both viewController viewDidLoad methods are calling super at the start of the method.

As I told before, if I just tap on other tab and then come back to this one, the slide back animation from "Partidos Activos En Fecha" viewController works as expected, it's only when I start the application and go directly to this viewController when the slide back animation doesn't work, and it just gets to the caller viewController without animation.

Hope I added enough info, if not just tell me and I will add it again.

回答1:

I finally found where the problem was, I was missing a call to super in the viewDidAppear method but in UITabBarController!, I was checking only viewControllers for the tabs but not the tabbarviewcontroller. @rdelmar was right.



回答2:

I had the exact same problem. The cause for me was an empty viewDidAppear:animated method in my UITabBarController. Once I deleted that method, the animation worked normally again.



回答3:

I think this it's what you want. If I understand, your problem is handle the stack of the navigation controller right? So, check that link.