0

我将 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

4

1 回答 1

0

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

TTThumbView * selectedThumb = [self.tableView hitTest:point withEvent:nil];
if (selectedThumb && [selectedThumb isKindOfClass:[TTThumbView class]]) {
    // Do something with this thumb
}
于 2012-01-27T16:15:15.757 回答