1

我在滚动视图中加载了几张图像。
我这样设置 C4ScrollView:

viewer = [C4ScrollView scrollView:CGRectMake(20, 30, 75, self.canvas.height - 50)];
viewer.contentSize = CGSizeMake(75, 1000);
[self.canvas addSubview:viewer];

然后我将图像放入并添加点击手势(在 for 循环中),如下所示:

C4Image* img = [C4Image imgWithUrl:imgUrl];    
[viewer addImage:img];
img.userInteractionEnabled = YES;
[img addGesture:TAP name:@"tap" action:@"tapped"];
[viewer listenFor:@"tapped" fromObject:img andRunMethod:@"imgTap:"];

然后我有一个名为 imgTap 的方法,如下所示:

-(void)imgTap:(NSNotification *)notification {
    C4Image *img = (C4Image *)notification.object;
    C4Log(@"image tapped");
}

但是 imgTap: 方法永远不会被调用......我做错了吗?还是我必须做一些不同的事情才能让 C4Image 识别手势?

4

0 回答 0