Detect collision of two UIView's in swift

后端 未结 2 911
北荒
北荒 2020-12-11 17:22

I have two UIViews on my ViewController. I added panGesture to first view and when i start moving this view the second view will move towards first view. I want to detect an

2条回答
  •  一生所求
    2020-12-11 18:05

    what about

    if (CGRectIntersectsRect(secondView.frame, sender.frame)) {
            // Do something
        }
    

    CGRectIntersectsRect(::) : Returns whether two rectangles intersect.

提交回复
热议问题