我有一个UIScrollView,其中包含多个UIImageViews。

我想知道从滚动视图中窃听了哪个UIImageView。

谢谢

最佳答案

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

使用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;
}

关于iphone - 从滚动 View 打开图像到新的 View Controller ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9277420/

10-09 02:40