0

I am having more than one CAShapeLayer. While dragging two layers, I need to find whether it's intersecting are not.

But I tried in my way of calculating frame intersection and points intersection. But it's always returning frame as CGRectMake(0,0,0,0), I mean zero for all the layers frame as well the position too getting zero.

If any one knows give some idea.

Arnaud
  • 7,259
  • 10
  • 50
  • 71
Krish
  • 31
  • 3

1 Answers1

0

Try

if (CGRectIntersectsRect(layer1.frame, layer2.frame))
{
   /* Do something when the intersect.
}

I appreciate that you might want to know if the paths intersect, which is a more difficult calculation discussed here

Community
  • 1
  • 1
Lev Landau
  • 788
  • 3
  • 16