Is there a way to avoid viewDidLoad beeing called after every segue?

后端 未结 2 1510
说谎
说谎 2021-01-23 07:09

i initialize tables, data etc in my main ViewController. For more settings, i want to call another Viewcontroller with:

 DateChangeController *theController = [s         


        
2条回答
  •  南方客
    南方客 (楼主)
    2021-01-23 08:05

    I think you're taking the wrong approach - viewDidLoad is supposed to be called when it is called - it's a notification to you that the view is being refreshed or initially loaded. What you want to do is move that table initialization code somewhere else, or, at least, set a Boolean variable so that it is only called once. Would it work to create an object that has your table data when viewDidLoad is first called, then to check it to see if it's already been called?

提交回复
热议问题