I have two UIImageViews, one of them is moving from left to right, the other one is touch draggable. iI want NSLog to show up a message on console whenever imagetwo overlaps imageone. How Do I do this?
How do I detect whenever two UIImageView overlap?
4k Views Asked by John At
4
You can use the
CGRectIntersectsRect
function to easily test rectangle intersection, provided the UIImageViews share the same superview (more exactly, have the same coordinate space).Likely you will need to add code like the following:
to the UIView that hosts both image views, or a similar method that is called whenever the drag is completed.