I have a prototype cell on an iOS storyboard that includes a UIProgressView.
A background process that executes periodically notifies a delegate that it has started. This delegate should make the UIProgressView visible on the table cell, but this is not happening. Even though I can see the delegate being called it is not causing the UIProgressView to appear.
The delegate method tries to get a pointer to the UIProgressView like this:
UIProgressView* view = (UIProgressView*) [[[self tableView:myTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]] contentView] viewWithTag:MyProgressViewTag];
Where viewWithTag is set to the tag of the UIProgressView.
I have tried calling [myTableView reloadData] and [myTableView setNeedsDisplay] to try and force the redraw of the cell, but it has not worked.
Any ideas?
you request a new cell from the datasource of the tableView, the cell you get is not part of the tableView.
You want a cell that is already in the tableview, so ask the tableView for that cell.
try this:
And make sure you call this from the mainThread. You can’t manipulate UI objects from a thread that is not the main thread.