I am adding a new layer to the screen. All the layer that are visible are moved to random location based on user input. How to find out if sublayers are intersecting/ overlapping with any other layers?
// Move position by certain amount
static inline CGPoint CGPointAdd(const CGPoint a, const CGPoint b){
return CGPointMake(a.x + b.x, a.y + b.y);
}
// Add Sublayer
[self.view.layer addSublayer:lineLayer];
// Move all other layers
for(lineLayer in self.view.layer.sublayers){
lineLayer.position = CGPointAdd(lineLayer.position, 50);
}