last day (14 days later) » 

3:10 PM
0
Q: Method for visible cell in tableview

samitarmumI want to download an image to my tableViewCell but I only want the image downloaded to be inside a cell who is VISIBLE in my tableview. I want my tableView to download image when the tableviewcell is visible and during that time to display a loading bar or something until the download is finish...

 
Are you talking about asynchronous Image loading
 
Can you elaborate your question?
 
1. download the image and store it in local database then call the path. 2. Asynchronou image loading methods using to load the image while scrolling the tableview. 3. downloaded the image store it in data and assigned to array , after that call the array to show the image
 
Oh yes I use no.2: async image downloading, I only want to download image who are visible kinda like reddit official app
 
like button push to download the image and visible always after downloading right?
 
3:10 PM
No I dont use any button to download the image but yes the image should be visible always after downloading. I want the download to happen automatically without a push of a button
Can you figure it out yet
I was thinking to download the image when the tableview stop scrolling and then determine which cell is visible and then download the image
Do you think this is the correct approach
?
 
s
i think u r expecting first download the image after we will display the image visble always right
ur approch is not good
 
yes that is what i want
 
if tableview cell data loaded at the same time will load the image will take delay time.
 
but I use kingfisher to download the image asynchronously
its not on the main thread
 
NSURL* url = [NSURL URLWithString:[NSString stringWithFormat:@"http://myurl.com/%@.jpg",[[myJson objectAtIndex:indexPath.row] objectForKey:@"movieId"]]];
NSURLRequest* request = [NSURLRequest requestWithURL:url];


[NSURLConnection sendAsynchronousRequest:request
queue:[NSOperationQueue mainQueue]
completionHandler:^(NSURLResponse * response,
NSData * data,
NSError * error) {
if (!error){
cell.poster.image = [UIImage imageWithData:data];
// do whatever you want with image
}

}];
s it is not in mainthread
 
3:20 PM
ok
 
if load the image in the tableview at the same time image and tableview cell both are loading
samble link
 

last day (14 days later) »