Chris Muench
Chris Muench

Reputation: 18318

ios determine if subviews overlap (hit test?)

I have a bunch of subviews and want to determine if the BallView has hit the PaddleView. (I am making a simple version of breakout). What is the best way to do this?

BallView and PaddleView are both subview of BlockBreakerView

Upvotes: 1

Views: 678

Answers (1)

Eimantas
Eimantas

Reputation: 49335

You can use CGRect* functions. Something like CGRectIntersectsRect() will accept two rects (for a ball.frame and a paddleview.frame) and return simple BOOL denoting if they overlap.

Upvotes: 4

Related Questions