ios - 在 Swift 3.0 中检测两个对象之间的碰撞?

标签 ios swift collision-detection

我在屏幕上添加了 2 个 UIView,我想检测它们是否发生碰撞。如果是这样,那么我需要在屏幕上显示警报。

最佳答案

关于

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

关于ios - 在 Swift 3.0 中检测两个对象之间的碰撞?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42316446/

相关文章:

php - EasyAPNS 无法连接到数据库

iphone - Facebook iOS SDK 3.1 在 friend 墙上发布图片错误

ios - 在 VIewController 之间共享数据 - iOS

swift - 如何在 Swift 中删除字符串中的斜杠 "/"

pygame Pong - 如何归因我的评分系统和碰撞检测

iphone - 第一次使用协议(protocol) - Objective-C

ios - 如何检测文本词的主导语言?

ios - UINavigationController appDelegate UIViewController 以编程方式

ios - 接触时从场景中移除 Sprite

iOS:检测包含多个图像的 UIImageView 中的图像触摸