Refreshing a UITableView?

"YOU AND THE ART OF ONLINE DATING" is the only product on the market that will take you step-by-step through the process of online dating, provide you with the resources to help ensure success. Get it now!

SetNeedsDisplay when called on a background thread does pretty much nothing try this: cell performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:NO.

SetNeedsDisplay when called on a background thread does pretty much nothing, try this: cell performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:NO.

1 +1 for "on the main thread". Holy cow, was that driving me nuts! – Tim Keating Feb 10 at 6:38.

If not, that would be an ideal method. When the image loads, fire off a callback to the table view controller that sets the image on the cell, and then calls reloadData on the tableView. This way whenever a new image loads, the table will update to display it.

1 Jasarien is right, you should be using a delegate of some sort to callback to your ViewController updating the Image on the cell. You then can call reloadData or setNeedsDisplay on the cell. You should also consider NOT making your rows in advance.

This will kill performance and use a ton of memory depending on the number of cells. You should be re-using a limited number of cells. – Jab Jun 19 '09 at 13:17.

I would not try to load up the cells before you display the table - you should use lazy loading as much as possible to make sure you are making the most of the memory on a device. My suggestion would be to look at using a subclass of NSOperation to manage the loading of images. Firstly NSOperation will handle all the complexity of threading for you and allow you to queue up the operations.

You will then be able to prioritise the operations that you want completed for the cells at the top. As each operation completes you can make a call back to the cell or tableViewController (perhaps create a delegate protocol to make this really easy). If you have an operation per image/cell combination then you should be able to refresh each cell as the operation completes.

Doing this along with prioritising the operations will give you an optimal solution. If the NSOperations sound complex or you are put off by this - please do try it - it is a lot simpler than I might have made it sound.

OK, here's what I'm doing: from cellForRowAtIndexPath I'm sending set needs display to all visible cells. Yet, there's no diference and the cells are not updated. I'm starting to feel that setneedsdisplay is pretty much useles... – Mihai Damian Jun 23 '09 at 8:50.

Since the class MyTableController is a subclass of UITableViewController you don't need the attribute and property for myTableView. The tableView property is defined and initialized as part of UITableViewController's implementation with its dataSource and delegate set to the UITableViewController instance. This is why self.

TableView reloadData is calling your delegate and dataSource protocol methods.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions