0

我想做一些类似于 iPhone 的照片查看器的事情。单击时,UI 栏会在短暂延迟后消失。当您双击时,它会放大。但我不希望双击时发生任何事情,因为我还没有实现放大。

有人知道怎么做吗?

[这篇文章]并没有真正帮助。除非你告诉我有必要子类化UIGestureRecognizer. 然后,我想我可以弄清楚。有人有任何例子吗?

4

3 回答 3

2

查看UITapGestureRecognizer文档。您要查看两个属性:

  • numberOfTapsRequired; 和
  • numberOfTouchesRequired
于 2010-11-02T02:55:58.943 回答
0

下面是一些应该有帮助的代码:

UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
[scrollView addGestureRecognizer:singleTap];
[singleTap release];

UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
[doubleTap setNumberOfTapsRequired: 2];
[scrollView addGestureRecognizer:doubleTap];
// this next line will hold callbacks to singleTap until enough time has gone by that doubleTap is not a possibility.  If a doubleTap happens, singleTap will not get called. Otherwise, singleTap's callback gets called.
[singleTap requireGestureRecognizerToFail:doubleTap];
[doubleTap release];
于 2012-05-15T02:58:12.250 回答
0

查看 Three20 的 PhotoView。它做你想做的事。

于 2010-11-08T21:15:35.670 回答