If you want to detect when the rect of your ball is touching the edge of the rect of your maze (rather than just anywhere in the maze), you need to test for !CGRectEqualToRect(CGRectIntersection(ball, maze), maze)
in addition to CGRectIntersectsRect(ball, maze)
.