I have an issue where the tap gesture recognizer that I've made only workes on the very last item in the scroll view.
I have an array of images that are getting added to a UIImageView and the UIImageView is getting add to the ScrollView in the following code:
UIImageView *imageView1;
for (int i = 0; i < numberOfViews; i++) {
xOrigin = i * imageSize;
imageView1 = [[UIImageView alloc] initWithFrame:CGRectMake(xOrigin,50,100,50)];
[imageView1 setUserInteractionEnabled:YES];
[imageView1 addGestureRecognizer:tap]; // The gesture I want
[imageView1 setImage:[images objectAtIndex:i]];
[scrollView addSubview:imageView1];
}
// Set the contentSize equal to the size of the UIImageView
// scrollView.contentSize = imageView.scrollview.size;
scrollView.contentSize = CGSizeMake(numberOfViews * imageSize, imageSize);
// Finally, add the UIScrollView to the controller's view
[self.view addSubview:scrollView];
The above code works properly for adding the images in order onto the scroll view as well as adding the tap to the very last item in the on the list. That is, the rest of them are not getting the tap action?
Thanks in advanced.