开发者

how to get touch event on specified CGRectMake

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...
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜