You could check in the shape layer intersects a specific layer by checking intersection of the bounding box of the path agains the frame of the other layer.
BOOL doesIntersect = CGRectIntersectsRect(CGPathGetBoundingBox(path), layer.frame);
Question
I am drawing line over 5 custom uiviews (Like UITableView rows) from one position to another (X,Y axis)
using CAShapeLayer
.
My issue is that I want to know that what view the CAShapeLayer
(line in my case) is currently in. Is there any CGIntersect
for CALayer
and CGRect
etc? I am trying to create graph using core animation instead of any chart API.
Solution
You could check in the shape layer intersects a specific layer by checking intersection of the bounding box of the path agains the frame of the other layer.
BOOL doesIntersect = CGRectIntersectsRect(CGPathGetBoundingBox(path), layer.frame);