CGRectIntersectsRect with UIImageView

437 Views Asked by At

I have this image in PNG format link. I inserted this image in my application through a imageView.

All I'm trying to do is detect when another imageView slope that my candy cane image, for that, I used the code below:

CGRectIntersectsRect(self.bird.frame, TunelBot.frame)

But there is a small problem, my bird image was not even playing the Candy Cane image the CGRect already recognizes the touch, this is because the imageView have a rectangular shape, and the candy cane image has another shape.

Now, what I could to do, to detect when the image of the bird intersects in real shape of my candy cane image?

1

There are 1 best solutions below

0
On

The simplest approach is to test whether a given point of the drawing is transparent, as I explain here: https://stackoverflow.com/a/3763313/341994