I have one Masterview. It has lot of childviews. I am using the following code to detect the touched view and to bring front the corresponding view. The code works fine. But when I add subview to childview, it did not work.
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
self.hitView = nil;
self.hitView = [super hitTest:point withEvent:event];
int x = self.hitView.frame.origin.x;
int y = self.hitView.frame.origin.y;
NSLog(@"x = %d",x);
NSLog(@"y = %d",y);
if ([self.viewDelegate respondsToSelector:
@selector(view:hitTest:withEvent:hitView:)])
{
return [self.viewDelegate view:self hitTest:point
withEvent:event hitView:hitView];
}
else
{
[self bringSubviewToFront:self.hitView];
return hitView;
}
}