开发者

ZoomingPDFViewer zooms larger with no limits

开发者 https://www.devze.com 2023-03-02 15:32 出处:网络
I am using Apple\'s ZoomingPDFViewe开发者_JAVA百科r Sample, and want to ensure that the total zoom on a pdf never goes beyond 4, and it never goes smaller than 1 (original size), however, setting

I am using Apple's ZoomingPDFViewe开发者_JAVA百科r Sample, and want to ensure that the total zoom on a pdf never goes beyond 4, and it never goes smaller than 1 (original size), however, setting

self.maximumZoomScale = 4.0; self.minimumZoomScale = 1.0;

causes you to be able to continuously zoom bigger and bigger, and then never smaller again. Anyone know how to set absolute zoom maximum, rather than just the zoom level for each pinch?


The answer is simple. Just delete the two delegate methods:

- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view

and:

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale

Set the zoom scale limits on the storyboard and you're done!


If I remember correctly, this example resets it's zoomScale after every zoom back to "the new 1" - so you may have to manually save the zoom scale and re-set the maximumZoomScale dynamically.

0

精彩评论

暂无评论...
验证码 换一张
取 消