Best way to detect image overlap?

Discussion in 'iOS Programming' started by macfanboy, Mar 22, 2009.

  1. macfanboy macrumors 6502a

    Jun 5, 2007
    I was trying to detect when two imageviews (equally sized circles) overlap, and i was going to call a method every 0.01 seconds and using the below code. I thought there may be a better way to do this but i couldnt find out how. Any advice is greatly appreciated!
    if ( - = 75) {
         if ( - = 75) {
              //Whatever I want
  2. jpyc7 macrumors 6502

    Mar 8, 2009
    Denver, CO
    two comments

    1. Instead of checking every X seconds, you should just check whenever a circle moves. Or maybe you meant the circle movement rate was X seconds. Anyway, you get the idea that you don't need to check for overlap any faster than the circle movement rate.

    2. Your logic works, but you need a 'less than' sign in front of the 75 (which I assume is the radius of the circle).

Share This Page