How to detect tap on uiview with lots of controls?
        Posted  
        
            by 
                kodcu
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by kodcu
        
        
        
        Published on 2011-03-13T13:35:39Z
        Indexed on 
            2012/09/16
            21:38 UTC
        
        
        Read the original article
        Hit count: 304
        
My problem is about tap detection.
I have a uiviewcontroller and there are some controls on uiview (labels, buttons, tableview, imageview, etc..)
When I tap the uibutton I display a small uiview (200x150), if the user taps the uibuttons in smallview I hide the smallview.
But I can't hide the uiview if the user taps the background.
I tried this code..
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    //NSLog(@"Touches began.");
    [self hideShareView];
}
It doesn't work if I tap the another button in the uiviewcontrols view.
I just want my uiviewcontrol's uiview to react first.
I think its about firstResponder but I dont know how to set it first.
edit: i want it to work like a uiPopover in ipad.
© Stack Overflow or respective owner