Search code examples
iphoneuitouch

how identify touch in a particular view


How to get touch on a particular view.

I am using

CGPoint Location = [[touches anyObject] locationInView:self.view ];

but want to trigger the action only if an particular subView is clicked.
How to do this.


Solution

  • I got the answer myself...but thanks other which helped me on this

    here it is

    UITouch *touch ;
    touch = [[event allTouches] anyObject];
    
    
        if ([touch view] == necessarySubView)
    {
    //Do what ever you want
    }