Collision detection in sub items contained in two separate parent UIViews?

I initially set some conditions using CGRectIntersectsRect to detect conflicts that worked fine. On a larger scale of things, I only need a part of the visible view.

So, initially in ViewController 2 user interfaces were mapped.

Now I need to perform subtype conflict detection in two different UIViews that are contained in the view in which the view controller executes the logic.

My script no longer works, since I suspect that CGRectIntersectsRect compares only frames in the same view? I will continue to dig to confirm this.

Any ways to get around this? Is it possible, for example, to get the x and y pos submatrix relative to the main representation that executes the logic?

+1
source share
1 answer

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

+2
source

Source: https://habr.com/ru/post/1739056/


All Articles