views:

236

answers:

2

Hi all,

I want to know :

  1. How can I know that two imageViews are overlapping over each other?

  2. How can I know which imageView is overlapping which?

  3. How can I make the overlapping imageView go below and overlapped imageView come up?

For Example : If I have an arrow and a bow, if my bow is overlapping the arrow [i.e. physically the bow is over the arrow] then how to detect this and make arrow overlap the bow?

Can anybody please help me? Thanking you in advance.

A: 

make the overlay image as transparent add it to other image view , you have to organize the order of the image layer , bringtoFront to change the order....

Robin
A: 
  1. You can get the frame of each view and use CGRectIntersectsRect to determine whether they overlap.
  2. Using the answer to 1. Just test the intersects of the view frames.
  3. assuming your two views are siblings. Something like

    [siblingView1.superview sendSubViewToBack:siblingView2]

Ian1971