In my add contact page, i have a view and a scrollview on it and again a view on it. and in that last view i ve textboxes, etc. i have given the 'touchesBegan' method but it is called only for the view at the bottom. how to point that method to another view i.e., the view at the top?
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[self.AddView endEditing:YES];
}
One way this is how you can do :
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch= [touches anyObject];
if ([touch view] == image1)
{
//Action
}
}
Please Note : As you are using UIScrollView you might not able to get touches method for UIScrollView. In that case you might have to use UIGesture.
try
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [[event touchesForView:vTouch] anyObject];
if(!touch)
return;
CGPoint pointNow = [touch locationInView:otherView];
{
// code here
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With