I'm trying to implement a list language packages that can be downloaded by selecting a custom UITableViewCell that contains a UIProgressBar. For each language package I want to show the download progress. I get this done by setting this delegate setDownloadProgressDelegate:
.
Everything works great except when the UIProgressBar is moved out of the visible area. This makes sense because the delegates progress bar is removed. What can I do to stop the app from crashing and how can I display the progress bar if it returns to the visible area?
Hier is a picture to see what it looks like right now.
Thx
I suppose you could use a class of your own (or even the view controller) as progress delegate. In your view controller you could hold an array of references to all progress bars currently in use. You would create one progress bar per download and hold it in the array (thus the object would not be destroyed). Whenever a cell is being created you now have to check your array for the corresponding progress bar object instead of creating a new one. Whenever a download is done and the progress bar is no longer needed, you remove it from the array.
Beware of possible multithreading issues and if necessary (e.g. if your notifications could arrive in another thread than the main thread) use performSelectorOnMainThread:
to update the progress bar array and the progress bars within.