I have Several UIImageViews in a NSMutableArray. They are all in the superView. I want to check if a UIImageView intersects (collides, hits or touches) another UIImageView in the array. This is what I have been doing but I think there should be a better way.
for (UIImageView *b in _blocks) {
for (UIImageView *b2 in _blocks) {
if (CGRectContainsPoint(b2.frame, CGPointMake(b.center.x, b.center.y + b.frame.size.height/2))) {
// Do something
}
}
}
If I want to check if the image view is touching more than 2 views this way, the code is going to get very nasty. Thats why I want to know a better way to do it.
Do this: