views:

25

answers:

1

Hi

I have started creating a simple product image carousel. It basically comprises of 3 visible UIImageViews' and 2 hidden UIImateViews'. The UIImageViews are populated with images from an array and animate to give the appearance of of a carousel.

My next objective is to determine which product the user taps and push a detail view onto the stack.

My question is how should I determine which product image was taped?

The complication comes in, in that the UIImageViews switch positions during the animation and are populated with different images as the users "Scrolls".

A: 

You can use the tag property of UIView to give the image views an identifier to recognize them by.

For example When you set image1 to imageView1, set the tag of imageView1 to be 1. If you set image500 to imageView1, set the tag to be 500. When an imageview is tapped, check it's tag to determine which image was tapped.

Jerry Jones