I have an extended UIScrollView, which is taken directly from the Apple sample documentation project "ZoomingPDFViewer"
If you get this project, you will notice that its UIScrollView extension class “PDFScrollView” has a blatant error on startup (on the SIM device and)
If you zoom out far enough, you will eventually hit the zoom limits set by StoryBoard ... but then you can just pinch and go right outside.
I am trying to implement this class in my own project, and this error came with it.
For some reason, after the zoom completes, the zoomScale UIScrollView property is arbitrarily set to 1.0, so you can effectively zoom to infinity ... remember that zoomScale reset does NOT affect the content ... so you can simply zoom in and out until The PDF file in the demo will not be just a pixel on the screen.
I had never seen this before, and before I did a bunch of custom UIScrollViews.
I tried to follow a few steps but nothing works. Does anyone know what could cause UIScrollView to reset it to scale?
I thought it might be because subviews are removed and added during scaling, but I put a dummy view in the scroll view to act as a binding, and that didn't work either.
As I already said. ZoomingPDFViewer is the exact code I work with using iOS 6.0
Any ideas would be appreciated. Code example below
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale { NSLog(@"Ending Zoom %0.2f %0.2f", [self zoomScale], scale);
This is the end-of-scroll delegate ... both of these logs create a scaling that is exactly what you expect ... so ... any number other than 1.0 if you really zoomed in.
Then layoutSubviews is called ..
At this point, zoomScale reports as 1.0 no matter what ... it tracks 0.003 seconds after the End Zoom delegate method reports the correct scale.