从scrollview打开图像到新的viewcontroller

时间:2012-02-14 13:09:49

标签: iphone ios uiscrollview uiimage

我有一个包含多个UIImageViews的UIScrollView。

我想知道从滚动视图中点击了哪个UIImageView。

谢谢

1 个答案:

答案 0 :(得分:1)

将手势识别器添加到图像视图,然后在视图控制器(模态)中打开它

使用 UIGestureRecognizerDelegate 委托

UITapGestureRecognizer *gestureTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTap:)];
gestureTap.delegate = self;
gestureTap.numberOfTapsRequired = 2;
[image addGestureRecognizer:gestureTap];
[gestureTap release];



- (void)doubleTap:(UIPanGestureRecognizer *)gesture {
    NSLog(@"double tap on %@", gesture.view);

}

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
    return YES;
}