I want to ge开发者_如何学Got 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.
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...
}
精彩评论