iPhone UITableView shows one cached view in it's UITableCellView, the last one added!
I have an object that return a cached image view (UIImageView), which do the loading, showing the loading image, and then populate the view with the loaded image.
In my case, the TableView shows multiple rows, where the same user photo might appears more than once, and I noticed that because it is cached, it shown in the last cell it is been added to. I've tried to construct the UIImageView each time the table ask for a cel开发者_Python百科l, it works, so the problem is with the cached image view!, but i don't know why! hints?
I don't know if I did understand your problem.
So to resume, your problem is that the UIImageView in your cell is "always" the same ?
In TableView you need to "remove" UIImage from UIImageView if you use the same "reusable" cell. In the cell construction you create the UIImageView and add it to the cell.
if (NEED_CREATE_CELL) {
// create UIImageView etc
} else {
// Set nil to the image property of the UIImageView
// Like doing [ (UIImageView*)[ cell viewWithTag:80 ] setImage:nil ];
}
Does it answer to your question ^^?
精彩评论