简体   繁体   中英

Detect collision between transparent UIImageviews

I am searching for a pixel collision with two UIImageview with transparency.

The check should be done after an UIView was dragged and it should detect if the UIView overlaps another UIImageview. With CGRectIntersectsRect only the frames are compared. Maybe there is a solution of create a new UIImageview from the overlapped area and check if there is only transparency in it?

Maybe someone has another hint or solution?

您可以从CGRectIntersectsRect获取相交的帧rect,并为两个图像提取相交区域的Alpha通道值,如检索UIImage的像素alpha值所述 ,如果两者在同一位置上具有非零alpha,则碰撞为检测。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM