Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resize the Table cell height as per downloaded image height

I am getting the image's URL at run time and I want to download & display these images in a table. Images are going to be download asynchronously. What is more important is that I want to display all these images with their actual sizes.

Kindly help me. Thanks in advance:)

like image 778
rahul Avatar asked Apr 10 '12 16:04

rahul


1 Answers

On the delegate method you have to update the image when finished downloading you can use

[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] 
                 withRowAnimation:UITableViewRowAnimationAutomatic];

This will call again

    -(CGFloat)tableView:(UITableView *)tableView
heightForRowAtIndexPath:(NSIndexPath *)indexPath

So you should have it using the image's height if it exists, a default heigh, or a placeholder image if you have one.

like image 148
Juan de la Torre Avatar answered Sep 26 '22 05:09

Juan de la Torre