viewWillAppear not firing for UIViewController that belongs to UITabBarController until I switch tabs

I just made a new test app in Xcode with nothing but a UITabViewController (and its two child view controllers) in Main.storyboard, and when I override viewWillAppear for the first child, my "view will appear" log prints every time (including on app launch).

Here are a couple things that could cause viewWillAppear to not be called:

  1. Not calling super somewhere you've overridden viewWillAppear
  2. Adding a view controller's view somewhere as a subview without adding the view controller as a child view controller

You also might try seeing if viewWillAppear is getting called for your UITabBarController, and if not, is it being called for its parent or presenting view controller? And so on until you find where the holdup is.


Use the following line in viewWillAppear method of your vc1:

  [super viewWillAppear:animated];

Next, the UITabBarController must be your initial controller.


if you have Custom UITabBarController, check override func viewWillAppear is call super

in Custom UITabBarController

override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated) // this line need
    }