I have a CollectionView with UIImageView's in them and the images are defined in listImages array.
I am trying to get it so that when you click on a specified image, you will get redirected to a website with more information about that.
However, I don't know how to use the if clause to get the name of the image and by that give it a link.
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
listImages = [NSArray arrayWithObjects:@"7513-kirjatkuivumassa.jpg", @"kuppi.jpg", @"kuva1.jpg", @"juna-042.jpg", @"rautio-valamonruusut-helleaamuna-maalaus.jpg", @"pysähtynyt1.jpg", @"Screen-Shot-2013-02-20-at-21.07.38.jpg", @"sateenkaari.jpg", @"Screen-Shot-2013-02-21-at-17.04.22.jpg", @"moninaiset-e1391026376696.jpg", @"Tomperi+Metsä20111.jpg", @"3-shinot.jpg", @"Ulpukat.jpg", @"janne-e1391025808211.jpg", @"martikainen-240x240.jpg", @"takala-240x240.jpg", @"paanukallokaarme1.jpg", @"käsityök-240x240.jpg", @"kuvis-004.jpg", @"Se-on-hieno-2012-tammi-105x28x223.jpg", nil];
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
if ([[cell.listImageView text] isEqualToString:@"7513-kirjatkuivumassa.jpg"]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://website.com"]];
}
}