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.

Was it helpful?

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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top