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は、デフォルトで1行に最大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 に答える