开发者

Stop Images Disappearing when scrolling UITableView

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 guessin开发者_运维知识库g this is some performance/ memory management thing build into iphone?

How can I stop this behaviour?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜