Popping ViewController doesn't call viewWillAppear when going back

后端 未结 2 1375
难免孤独
难免孤独 2020-12-18 06:13

Whenever I pop a view controller manually, viewWillAppear doesn\'t get called on the previous UIViewController that now appears.

These are

相关标签:
2条回答
  • 2020-12-18 06:18

    You cannot have a UITabBarController "inside" of a UINavigationController. That's probably why some of the viewWillAppear methods aren't being called. Take a look here: Tab bar controller inside a navigation controller, or sharing a navigation root view

    0 讨论(0)
  • 2020-12-18 06:26

    I have created this class that solves your problem. I have used it in many of my own projects.

    Just set it as a delegate of your navigation controller, and implement simple one or two methods in your view controller - that will get called when the view is about to be shown or has been shown via NavigationController

    Here's the GIST showing the code

    0 讨论(0)
提交回复
热议问题