What is better place for loading data from API- viewDidLoad, viewWillAppear or viewDidAppear?

后端 未结 6 1505
无人及你
无人及你 2020-12-16 02:03

I am making an IOS app where i am calling an API in viewDidLoad method of view controller. Now i want to reload the same view controller with the data that comes from server

6条回答
  •  猫巷女王i
    2020-12-16 02:36

    viewDidAppear is definitely not the one you want to use, it will 'pause' the view from responding while you're loading the data.

    Normally viewDidLoad is the one you want to place it.

提交回复
热议问题