views:

182

answers:

1

I have a UI Table View Controller. Each Cell Loads an image from my webserver. If I scroll the TableView so that a particular cell scrolls out of view and then scroll back again the image for that cell has vanished and I have to wait for it to reload.

I'm guessing this is some performance/ memory management thing build into iphone?

How can I stop this behaviour?

A: 

I believe the cells in the tableview are recycled.

cache the images in memory and assign from your cache rather than loading the images directly into the tableview

I don't know if this is best practice or not but I think you could use an NSArray or NSDictionary of UIImage and load into there first and just assign references to the objects in the array.

Update

There is some code here which uses an NSMutableDictionary for the cache

PeanutPower
Thats great. Thankyou
dubbeat