# IPhone: CGRectIntersectsRect ()

1 answer

When you use CGRectIntersectsRect (), you get a CGrect, which is the intersection of both rectanlges, so based on the area of ββthat rectangle, you can get if it's more than 50%.

Something like that:

```
CGrect *interRect = CGRectIntersection(rect1, rect2);
if ((interRect.size. width * interRect.size.height) > (rect2.size. width * rect2.size.height*0.5) return Yes;
```

I am multiplying the width * height to get the area of ββthe rectangle.

+6

source to share