I am using UIGridView Repo to create a grid view of images from a feed. But when I am using the following code I get the same image filling all the grid.
-(UIGridViewCell *) gridView:(UIGridView *)grid cellForRowAt:(int)rowIndex AndColumnAt:(int)columnIndex
{
Cell *cell = (Cell *)[grid dequeueReusableCell];
if (cell == nil) {
cell = [[Cell alloc] init];
}
NSString *imageLink = [item objectForKey:@"link"];
NSURL * imageURL = [NSURL URLWithString:imageLink];
NSData * imageData = [NSData dataWithContentsOfURL:imageURL];
UIImage * image = [UIImage imageWithData:imageData];
cell.thumbnail.image = image;
return cell;
}
How can I fill the grid with all the images from the array?
Thanks in advance
In your
gridView's cellForRowAtmethod you are usingsame image linkfor allUIGridViewCell.Get different linkfromfeedand depending onrowIndex and column indexusedifferent imageEDIT : For example i assume u have 4 images in row