如何检测2个UIImageViews的形状完美交集

时间:2012-11-02 08:52:08

标签: iphone objective-c xcode uiimageview

请问,如何检测2个图像视图之间的精确交叉。在每个图像视图中是透明的png,我不想检测他们的矩形框架内的交叉点,而不是他们的真实形状?感谢您的任何建议。

3 个答案:

答案 0 :(得分:1)

您可以使用CGRectIntersectsRect()来查看是否有任何UIImageView与另一个UIImageView相交。

答案 1 :(得分:1)

试试这个,这肯定是你的答案

if(CGRectIntersectsRect(imageview1.frame, imageview2.frame)) {

//They are intersecting
}

答案 2 :(得分:1)

DCInstrospec
DCIntrospect将帮助您