in iphone uitable view data desplay problem
i have a uitableview in that i display data with the help of network queue . I use CellIdentifier like this,
NSString *CellIdentifier = [NSString stringWithFormat:@"%i_%i" , indexPath.section , indexPath.row];
and check condition
if(cell ==nil)
{
}
so data is loaded only one time .
by doing this, it loads data but the problem is in imageview. the image size is big so it takes some time. if image is not loaded and user scrolls the ta开发者_如何学Cble then that image is never seen. To see the image we have to wait till it is loaded and then we scroll the table.
Is there any way to load the image again which are not loaded.
I dont want to load all data again .
You understood if(cell == nil) {} wrong.
This condition should not be used so your data is only loaded one time, this should be used to construct a new cell only when necessary.
You have to setup each cell outside of this condition.
And you should definitely not use a different CellIdentifier for each cell. This is a bad hack introduced by people who are to "lazy" to implement lazy loading of cell images correctly.
You should see the LazyTableImages example from apple to see how it should be done.
For loading images in table view, you can use good LazyTableImages Example by Apple. You don't have to write this type of code (different cell identifier for each). You have to reuse table view cell as per apple document otherwise it will take too much memory while scrolling.
精彩评论