How can programmatically check if 2 objects are overlapping on my UIViewController
? I am using this method to randomly move the objects around the UIView
.
CGFloat x = (CGFloat) (arc4random() % (int) self.container.bounds.size.width);
CGFloat y = (CGFloat) (arc4random() % (int) self.container.bounds.size.height);
CGPoint squarePostion = CGPointMake(x, y);
_button.center = squarePostion;
I have 3 objects I am moving around using this fragment of code. Sometimes they overlap each other, which is a problem. Is there anyway I can check if the objects are overlapping each other before I make them visible?
Thanks guys!