UIViewController viewWillAppear not called when adding as subView

前端 未结 8 1405
野性不改
野性不改 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:11

    The previous answers are correct, but in case it helps someone - if you override loadView in the child view controller, then none of the other UIViewController methods get called.

    Took me some time to realize why my code wasn't running properly, until I realized that I had accidentally overridden loadView instead of viewDidLoad.

提交回复
热议问题