Apple ZoomingPDFViewer won't allow dragging until after first zoom
I'm using this sample code to view a PDF in my iPhone app:
http://developer.apple.com/library/ios/#samplecode/ZoomingPDFViewer/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010281-Intro-DontLinkElementID_2
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.
Any ideas?
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.
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.
Setting the zoomScale of uiscrollview to 1 in initFrame of PDFScrollView (just as u suggested above) doesn't makes the view scrollable on loading for me? Did you put any other change as well?
If you have been able to figure out why this is happening, please let me know as well...
This is because the pdf is a 'feature'. once you are above a zoom scale of 1.0, then the page will always be in the center of the screen and you will not be able to drag it. So, when you zoom out past the 1.0f value, (after the initial zoom in), it will not allow you to move around anymore.
I think the layoutSubviews
method is what does this - though I am not sure. It is the method that keeps the content centered at least.
Was stuck on this problem for almost a whole day. In the far right window, click on the far left button like so
Then uncheck the "Use Autolayout"
精彩评论