TableViewController not updating cells

后端 未结 2 1977
既然无缘
既然无缘 2021-01-26 11:12

This app allows Rider to request a ride and driver to accept the request. In this tableview are the rides the riders (2) have requested.

Unable to update tableviewcel

2条回答
  •  暖寄归人
    2021-01-26 12:03

    The callbacks from Geocoder are asynchronous and you can't simply change the values in the table cells by updating the label values inside the callback - you have to inform the table view to reload the cell in order to update it.

    So, you need to pull out the GeoCoder lookups from inside tableView:cellForRowAt and move them into a loop in either viewDidLoad or viewWillAppear. The final values should form part of you model.

    Inside the callbacks for the GeoCoder you would then tell the table view to reload each individual cell calling tableView.reloadRows with a single value array.

提交回复
热议问题