2

I have noticed that when a table view cell contains a UIProgressView that is frequently updated, the scrolling behavior of the table view is affected significantly.

To be more precise, due to the frequent updates of the progress view the table view's position changes slightly while the table view's "rubber band" animation is animating. The same thing happens when the table view is pulled while at the top. It is tricky to explain, but I hope you get this gist.

Of course, updating the progress view on in the background is not possible due to how UIProgressView works behind the scenes. Is this a know issue? Is there a solution for this problem?

Bart Jacobs
  • 9,022
  • 7
  • 47
  • 88
  • 1
    Its just my suggestion, set a bool variable make it true when user started scrolling table view dont update uiprogressview while user scrolling and when scrolling ends update the progress views and set the bool variable false. – prasad Sep 08 '12 at 16:40
  • This is a good suggestion, but unfortunately it does not solve the problem. – Bart Jacobs Sep 09 '12 at 06:31

2 Answers2

1

I am not sure if this problem can be solved without a workaround. The solution that I have found uses a timer and a progress cache. My guess is that Apple uses a similar approach.

The solution that I have come up with involves the creation of an object, an array or dictionary, that keeps track of the progress of each item displayed in the table view. Instead of updating each cell whenever the download progress changes for a table view cell, the view controller that manages the table view updates the visible table view cells at regular time intervals, which could be as frequent or infrequent as you'd like.

I think this is how Apple does it. The progress views in the downloads view of the Podcasts application, for example, updates at regular time intervals and doesn't progress smoothly, which supports my guess that Apple uses a timer to update the table view.

Bart Jacobs
  • 9,022
  • 7
  • 47
  • 88
0

It doesn't sound like normal UITableView behaviour. I'm trying to understand what you mean when you say "updating the progress view on in the background is not possible due to how UIProgressView works behind the scenes". If you make sure that all non-UI operations are done in the background and only perform the update to the UIProgressView on the main thread, these artefacts are bound to disappear.

Stavash
  • 14,244
  • 5
  • 52
  • 80
  • What I mean to say is that updating the UIProgressView on a background thread is no option. It is odd indeed. The UITableViewCell containing the UIProgressView receives a call to update the progress view through KVO and that is all that happens in the update (of the progress view) cycle. – Bart Jacobs Sep 10 '12 at 12:20