【问题标题】:How to identify a touched photo in TTThumbsViewController by Three20 via gesture?Three20如何通过手势识别TTThumbsViewController中触摸的照片?
【发布时间】:2012-01-16 08:17:12
【问题描述】:

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

}

但是使用该 sn-p 我只能识别行而不是我选择的对象 TTThumbsViewController 默认情况下可能在一行中最多有 4 个元素。

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

最好的问候,hijolan

【问题讨论】:

    标签: objective-c three20 uigesturerecognizer ttthumbsviewcontroller


    【解决方案1】:

    你总是可以使用 UIView 的 hitTest 功能

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

    【讨论】:

    • 我会在接下来的几周内试一试,然后将答案标记为正确。我还找到了另一种解决方法,我也会发布它......谢谢你的回答,hijolan
    猜你喜欢
    • 2017-04-23
    • 1970-01-01
    • 2018-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多