I have a scenario where I want to keep "thumbnails" of images on the row of the tableview. I decide on runtime the numbers of images that goes in a row.
Secondly, On click of any of the image I want to launch a viewcontroller with elaborated image of it with some description.
How can I achieve this?
|________________|
| 1 2 3 4 5 6 |
|________________|
| 7 8 9 10 11 12 |
|________________|
| 12 14 15 |
|________________|
Imagine the numbers above as thumbnails. Onclick of any of the number I want to launch a new view controller which gives details about the image.
code snippet:
-(void) populateTableView
{
NSMutableArray* srcArray = [[NSMutableArray alloc] initWithArray:[[ImageDataSource sharedImageDataSource] getThumbnailsSrcArray]];
int noOfImages = srcArray.count;
float rowc = (noOfImages / ROW_ELEM_COUNT) + 0.5;
int rowCount = roundf(rowc);
titleData = [[NSMutableArray alloc]init];
int j=0;
for (int i=0; i<rowCount; i++) {
NSMutableArray* rowArray = [[NSMutableArray alloc] init];
for (int k=0; k < ROW_ELEM_COUNT; k++) {
if (j < noOfImages) {
NSString* imgPath = [srcArray objectAtIndex:j];
UIImage* img = [[UIImage alloc] initWithContentsOfFile:imgPath];
[rowArray addObject:img];
[img release];
imgPath=nil;
}
j++;
}
[titleData addObject:rowArray];
}
titleView = [[UITableView alloc] initWithFrame:CGRectMake(90.0,156.0,590.0,630.0)
style:UITableViewStyleGrouped];
titleView.delegate = self;
[self.view addSubview:titleView];
[titleView release];
}
So basically I have array of array as my DS. index of each array will be row of table view and the array inside will have images. But I am not sure how to populate the tableview. Any clue anybody?