I am making a game which has 10 UITableViewCells
in a UITableView
. Each of the 10 UITableViewCells
has one UIProgressView
plus a lot of other views. I update the UITableView
every 1/10th of a second, this is very slow and lags on older devices. I update it every 1/10th second for UX, gives a smooth progress view feel to game.
Is there a way to just update just the Progress Views in each cell individually rather than having to call the tableView.reloadData()
that will update all the views in each cell?
Code example:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = self.tableView.dequeueReusableCell(withIdentifier: "businessCell", for: indexPath) as! BusinessCell
cell.progress.progress = Float( businessArray[indexPath.row-1].getCurrentProgress() )
//lots of other views are updated here
return cell
}
}
could I maybe change this line:
cell.progress.progress = Float( businessArray[indexPath.row-1].getCurrentProgress() )
to something like this:
cell.progress.progress = someVarLocalToViewControllerContainingTableView[indexPath.row]
and when I update this local var it would update only the progressView or something? I have tried many ways but cannot figure out how to do this...