Question: Now a days in several of my iOS applications I need to get adjacent views recursively. I wonder if we have any thing like `viewAtLocation:(CGPoint)location`? Or there's any way we can implement it.

I have used several ways like C array `id matrix[row][col]` with location decided by size as index value, and retrieving all `subview` then checking for `location` one by one in a loop etc. Although these are working for me but these doesn't seems good or say appropriate to me. So what else we can have?

Answer: 
It's best to use the standard [`hitTest:withEvent`](https://developer.apple.com/library/ios/documentation/uikit/reference/uiview_class/uiview/uiview.html#//apple_ref/occ/instm/UIView/hitTest%3awithEvent%3a) which will handle things like ignoring a view if it's opacity is 0.0. The documentation says to pass in `nil` for the event when calling it manually.

This will also behave correctly for any views which have extended their bounds using `pointInside:withEvent:`.
The following code will do it for you bro

```
UIView *view = <Your View>;
UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
[view addGestureRecognizer:recognizer];
[recognizer release];

- (void)handleSingleTap:(UITapGestureRecognizer*)recognizer{

    CGPoint p = [recognizer locationInView:recognizer.view];
    for (UIView *v in recognizer.view.subviews) {
        if (CGRectContainsPoint(v.frame, p)) {
            NSLog(@"view Found with frame %@",NSStringFromCGRect(v.frame));
            //If your views doesn't overlap then break from here
            break;
        }
    }
}

```