0

在我看来,我使用三种方法(touchbegan、touchmoved 和 touchended),因为我在视图中着色;我的问题是我想在这个视图中添加一个带有 2 个水龙头的 UITapGestureRecognizer;是否可以?还是 touchbegan 不允许这个手势?

4

2 回答 2

1

雅它可能

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
[super touchesBegan:touches withEvent:event];

UITouch *touch = [touches anyObject];
if([touch tapCount] == 2){
     NSLog("2 taps");
}
}

愿这对你有帮助

于 2012-06-12T10:42:05.350 回答
-1
    UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapDetected)];
    doubleTap.numberOfTapsRequired = 2;
    [self.view addGestureRecognizer:doubleTap];
    [doubleTap release];


-(void)tapDetected{
    NSLog(@"Double Tap");

}
于 2012-06-12T10:51:07.687 回答