Collision detection on sub views contained in 2 separate parent UIViews?

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-03-27T20:08:47Z Indexed on 2010/03/27 20:13 UTC
Read the original article Hit count: 136

Hi All,

I originally setup some conditions using CGRectIntersectsRect for some collision detection which worked fine. In the greater scale of things I only need part of the view to be detected.

So originally within the ViewController it was comparing 2 UIviews.

Now what I need to do is collision detection of subViews within 2 different UIViews that are contained in a view in which the view controller does the logic.

My script is no longer working as I suspect CGRectIntersectsRect only compares frames within the same view? I'll keep digging to confirm this.

Any ways around this? Is it possible for example to get the x and y pos of the sub view in relation to the main view that's performing the logic?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone-sdk-3.0