TableView.reloadData() is not working ? (SWIFT)

前端 未结 3 737
失恋的感觉
失恋的感觉 2021-01-24 10:09

I am developing a Quiz App which fetches questions from a JSON. I have already used reloadData for TableView many times & worked as expected. But now I am fetching Questions

3条回答
  •  长发绾君心
    2021-01-24 10:49

    Sounds like you need to put the reload into the completion handler so that you have data when you try to update the UI.

    To be safe (in case of other calls to reload), you can also guard your return value in numberOfRowsInSection by checking whether there are at least 5 items in QArray.

提交回复
热议问题