tags:

views:

23

answers:

3

hi i am new to iPhone.What i did is displaying the 4 imageview and animating them,means imageviews are moving randomly in view.Now how can i handle the particular selected imageview.when ever i select the an imageview among the four imageviews the selected imageview animation will stop and i need to get notification of which imageview is selected.how can i done this pls post some code or link.thank u in advance.

+1  A: 

Make them UIButtons and use: [button setImage:forState:] then you can use targets and actions.

Thomas Clayson
A: 

take look at touchesBegan,touchesMoved functions

king maker
A: 

Hello

They are different ways and it depends on how you are currently moving the UIImageView.

1°) If UIImageView are not subclassed, who could check in the upper UIView when one is touched. To do this, use touchesBegan and touchesMoved function.

UITouch *touch = [ touches anyObject ];
CGPoint location = [ touch locationInView:view ];

With the location you can find if it's touching one of your 4 UIImageView and then doing what you want

2°) The other way, little more difficult but the one I prefer. You subclass UIImageView, animate them in this class, and when you get a touch Event stop the animation and do the same things that in 1°). By the way you may need to create a delegate to call function in others classes or use some Notifications

Good Luck ! Vincent

Vinzius