I trying to set multiple images from SQL into Table View Cells using
SDWebImage.
I am using this code right now but this loads one image based on a URL.
[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
How would you populate the imageView for multiple images? Thanks.
I tried using a for-loop. Does not work.
NSArray *itmImageArray = [self itemImages];
for(int i = 0; i <= [itmImageArray count]; i++)
{
[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/%@",[itmImageArray objectAtIndex:i]]
placeholderImage:[UIImage imageNamed:@"addnewimage.png"]];
}
A UITableViewCell has only one imageView. The technique you are using will keep resetting the same imageView that a UITableViewCell has by default and what you will see is the last image of your for loop set in the cell. If you want to display more images you will have to create a custom cell and add multiple UIImageViews as subviews of the cell. You can then set different images into the UIImageViews you add. Remember, you will have to handle the frames of UIImageViews as well as height of the tableView row so that the content is displayed properly.