如何通过手势识别由Three20在TTThumbsViewController中触摸的照片?

时间:2012-01-16 08:17:12

标签: objective-c three20 uigesturerecognizer ttthumbsviewcontroller

我将TTThumbsViewController子类化,以集成上传过程。作为回报,我还想整合一个删除过程。

我的情况: 我在点击照片时添加了GestureRecognizer:

UILongPressGestureRecognizer* recognizer = [[UILongPressGestureRecognizer alloc] 
                                             initWithTarget:self action:@selector(deleteImage:)];
[self.view addGestureRecognizer:recognizer];

...

- (void)deleteImage:(UILongPressGestureRecognizer*)recognizer {
  __block IMHRemotePhoto *photo = [self.dataSource 
                                    tableView:self.tableView 
                                    objectForRowAtIndexPath:[self.tableView
                                    indexPathForRowAtPoint:gestureStartPoint]];

}

但是使用该片段我只识别行而不是我选择的对象TTThumbsViewController每个默认情况下最多可以有4个元素。

任何想法如何做到这一点?

最好的问候,hijolan

1 个答案:

答案 0 :(得分:0)

你总是可以使用UIView的hitTest函数

TTThumbView * selectedThumb = [self.tableView hitTest:point withEvent:nil];
if (selectedThumb && [selectedThumb isKindOfClass:[TTThumbView class]]) {
    // Do something with this thumb
}
相关问题