0

在 UIView 上的某个位置双击后,我有点堆积了应该执行某个任务的功能。我知道如何计算点击次数,但不知道如何确定已点击的位置,我想与为执行此操作指定的视图 CGRect 进行比较。

提前谢谢

4

2 回答 2

1

采用

Point point = [touch locationInView:self.view];
于 2010-10-12T11:31:30.553 回答
1

我们可以用 touchesBegan 检测

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
     NSUInteger numTaps = [[touches anyObject] tapCount];
UITouch* t;

if([[event allTouches] count]==2)//double tap
    {
     t=[[[event allTouches] allObjects] objectAtIndex:0];
 CGPoint p1=[t locationInView:self.view];
     }

numTaps 给出了 taps 的 nuber 。

P1 具有被轻敲的点。

祝一切顺利。

于 2010-10-12T11:38:01.087 回答