viewDidLoad is called twice

前端 未结 5 598
暗喜
暗喜 2020-12-10 06:43

My viewDidLoad in a view controller is called twice. Once by [UIViewController View] and a second time by [UINib instanciateWithOwner:Option

5条回答
  •  无人及你
    2020-12-10 07:36

    In my case, I used self.view (once) in viewDidLoad while calling viewDidLoad in my unit tests. This resulted in two calls. However, when I replaced [testedViewController viewDidLoad] with [testedViewController view], the double call problem was gone.

提交回复
热议问题