Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有什么简单的方法可以检查一个 UIImageView 是否在另一个 UIImageView 上?我的视图有标签,它们相互覆盖,它们移动,主要问题是我想隐藏所有视图,如果它不在顶部,我如何检查哪个视图在顶部?谢谢
CGRectIntersectsRect如果 rect1 的任何部分位于 rect2 内部,则将返回 true。
CGRectIntersectsRect
例子:
if (CGRectIntersectsRect(rect1.frame, rect2.frame)) { //rect1 is lies inside rect 2 }