缩放和平移在 iOS 中 UIScrollview 顶部的 CATiledLayer 中绘制的 pdf 后正确的触摸位置

Correct touch location after zooming and panning a pdf drawn in CATiledLayer on top of the UIScrollview in iOS

我正在开发 Atlas App,我在其中显示可以使用 pdf 文件缩放和平移的地图。为此,我正在使用 vfr reader,它工作正常。我想检测触摸位置,以便选择正确的状态。当视图未使用以下代码缩放和平移时,我得到了正确的坐标:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject]; 

    CGPoint point = [touch locationInView:theScrollView];
}

但是,当我缩小和平移它时,触摸位置发生变化,我没有选择正确的状态。我将如何获得正确的选择状态?

调试 vfr reader classes 我发现我可以在 ReaderContentPage class。 class 在缩放后也给出了正确的触摸位置。您可以在 processingSingleTap 方法中获取点,如下所示:

- (id)processSingleTap:(UITapGestureRecognizer *)recognizer
{
    CGPoint point = [recognizer locationInView:self];
}

CGPoint点给出了正确的触摸位置。然后使用委托方法在所需的 class.

中获取正确的坐标