tags:

views:

40

answers:

1

I want to get touch event on UIImageView with specified location only.

UITouch *touch=[touches anyObject];
CGPoint currentPoint=[touch locationInView:CGRectMake(0,0,100,100)];

CGRectMake(0,0,100,100) In the specific location i need touche event, is it possible. What to do?

Thanks in advance.

+3  A: 

In touchesBegan and touchesMoved:

UITouch *touch=[touches anyObject];
CGPoint currentPoint=[touch locationInView:self];

CGRect testRect = CGRectMake(0,0,100,100);

if(CGRectContainsPoint(testRect, currentPoint)) {
     //For if you are touching the 100 x 100 rectangle...
}
thyrgle
Thank thyrgle....Its working fine
kiran
If it's working fine, you should give credit to the person that answered by accepting their answer. See the stackoverflow FAQ for more information: http://stackoverflow.com/faq#howtoask
GregInYEG
@GreglnYeg. I do not have any idea about crediting to the person. i just click now check mark. Is that i credited thyrgle.
kiran