Search code examples
iosswiftanimationuinavigationcontrolleruitabbarcontroller

Pushing view onto navigation controller in tab bar controller does not animate


I have a very peculiar problem.

My setup is a UITabBarController with two UINavigationController -> UICollectionViewController children.

  • If I say navigationController.pushViewController(someVC, animated: true) in viewDidAppear, the view controller is pushed as expected.

  • However, if I say navigationController.pushViewController(someVC, animated: true) when a cell from the collectionView is tapped, the view controller appears, but there is no animation/interactivity when going back (I cannot slide, and the buy button makes the controller instantly disappear).

This is really frustrating because I can think of no explanation. Why would the animations and interactivity work when pushed from viewDidAppear but not when pushed from a different function?

Why on earth is this happening, and how can I fix or get around it?


Solution

  • Well I have not figured out what is causing this issue, but I did find a (rather inconvenient) solution: Set the tab bar items in viewDidAppear. Use a short splash screen or something until then.

    I'm not sure what the original problem was, though, so it would be great if anyone else had any explanations!