Apple ZoomingPDFViewer直到第一次缩放后才允许拖动 [英] Apple ZoomingPDFViewer won't allow dragging until after first zoom

查看:47
本文介绍了Apple ZoomingPDFViewer直到第一次缩放后才允许拖动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下示例代码在我的iPhone应用程序中查看PDF:

I'm using this sample code to view a PDF in my iPhone app:

但是,问题是我似乎无法一开始就拖它.我可以先捏和缩放,然后缩放一次,然后就可以拖动视图了.当视图首次加载时,我只是无法拖动.

However, the problem is I can't seem to get it to be drag initially. I can pinch and zoom initially, and after I've zoomed once, then I can drag the view around just fine. I just can't drag when the view first loads.

有什么想法吗?

推荐答案

我想我已经找到了一个解决方案,尽管为什么这不仅行得通,还超出了我的范围.如果设置zoomScale属性,即使将属性设置为1,它似乎也会触发进行拖动和滚动所需的任何操作.

I think I've figured out a solution, though why this doesn't just work is beyond me. If you set the zoomScale property, it seems to trigger whatever is needed to allow dragging and scrolling to take place, even if you set the property to 1, which does nothing.

我只是在UIScrollView的initWithFrame:方法中做到了这一点

I just did this in the initWithFrame: method of the UIScrollView:

...
self.zoomScale = 1;
...

如果其他人知道执行此操作的更好或更正确的方法,或者对发生这种情况的原因有解释,我想知道.

If anyone else knows of any better or more correct way to do this, or has an explanation for why this happens, I'd like to know.

这篇关于Apple ZoomingPDFViewer直到第一次缩放后才允许拖动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆