I am using UIGridView as 2 Column is there and there are list of array in which images kept. Now I want to compare two car so that i have to mark any two images in UIGridView
. So that I can compare any two cars. i am not fully aware of GridView.
Compare should be happened when red navigation button clicked.
My Code is Given Below:
CarArray = [[NSMutableArray alloc]init];
[CarArray addObject:@"image.png"];
[CarArray addObject:@"car-image.png"];
[CarArray addObject:@"mercy.png"];
[CarArray addObject:@"lanbo.png"];
}
- (CGFloat) gridView:(UIGridView *)grid widthForColumnAt:(int)columnIndex
{
return 160;
}
- (CGFloat) gridView:(UIGridView *)grid heightForRowAt:(int)rowIndex
{
return 200;
}
- (NSInteger) numberOfColumnsOfGridView:(UIGridView *) grid
{
return 2;
}
- (NSInteger) numberOfCellsOfGridView:(UIGridView *) grid
{
return [CarArray count];
}
- (UIGridViewCell *) gridView:(UIGridView *)grid cellForRowAt:(int)rowIndex AndColumnAt:(int)columnIndex
{
Cell *cell = (Cell *)[grid dequeueReusableCell];
if (cell == nil) {
cell = [[Cell alloc] init];
}
cell.thumbnail.image=[UIImage imageNamed:[CarArray objectAtIndex:(rowIndex*2+columnIndex)]];
return cell;
}
- (void) gridView:(UIGridView *)grid didSelectRowAt:(int)rowIndex AndColumnAt:(int)colIndex
{
NSLog(@"%d, %d clicked", rowIndex, colIndex);
CarDetailViewController *servicesViewController_obj=[[CarDetailViewController alloc]initWithNibName:@"CarDetailViewController" bundle:nil];
[self.navigationController pushViewController:servicesViewController_obj animated:YES];
}
i also want to implement mark and unmark so i can move further.