开发者

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

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 ViewContro开发者_StackOverflow中文版ller 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?


You'll need to use UIView's convertRect:toView: or convertRect:fromView: (or the point equivalents) to get them in the same coordinate space.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜