UIViewController viewWillAppear not called when adding as subView

前端 未结 8 1416
野性不改
野性不改 2020-12-14 06:43

I have a UIViewController that I am loading from inside another view controller and then adding its view to a UIScrollView.

self.st         


        
8条回答
  •  臣服心动
    2020-12-14 07:25

    I can't understand your questions and your description. My problem was similar to this only.

    CustomTabBarController -> CustomUINavigationController -> RootViewcontroller

    viewWillAppear of CustomUINavigationController and RootViewController are not getting called unless you switched to another tab and come back.

    The solution is call super.viewWillAppear(animated: true)

    override func viewWillAppear(_ animated: Bool) {
        **super.viewWillAppear(true)**
    }
    

    I struggled for more than a day for this small mistake.

提交回复
热议问题