views:

168

answers:

1

Hi Guys

how can a pop up alert cum when an bouncing img touches a dragable image like how it is done in this app http://tinyurl.com/kspnh6

Example there is an image that is going up and down the screen and it touches an image that we can drag here & there,how can v bring a alertview when that image touches the moving image

thanks

A: 

When you move the dragged view around, check the updated frame property against that of the other items.

You can use a function such as CGRectIntersectsRect to determine if the frame of any two views overlap each other (i.e. when it's time to show the alert).

This acheives a rectangular "hit test", there would be more work involved if you wanted the hit test to respect rounded shapes etc.

Christopher Fairbairn