NSThread and UIProgressView on an UITableCells
I have a project in which a series of NSThread objects do something and display the progress on the relevant UIProgressView. I display and custom draw these UIPro开发者_运维百科gressViews on a UITableView. I set the progress delegate of each NSThread to a certain UIProgressView one by one.
One problem is that if I drag and move up/down any UITableCell, some UITableCells on the top and bottom of the UITableView will disapear(cell becomes nil) and need redraw.
All controlls on these UITableCells can redraw correctly, except these UIProgressView.
I do not know when I redraw the UIProgressView, wheather I need to reassign the delegate relationship between the progress delegate of each NSThread and its linked UIProgressView.
Thanks
interdev
That's a really nasty situation your are getting yourself into. I'd have the threads update a model object, and have the UIProgressViews attached to items in your model when they are displayed. That way the model is always updated correctly.
I can then think of a number of ways of updating the UIProgressViews : Subclass, and update after an NSNotification, or do it with KVO I guess.
精彩评论