I use UIScrollView scaling to display images in my iPad app. Scaling works fine, with a pinch, making the image smaller or larger if necessary. I also have bouncesZoomit return to the minimum or maximum increase if the user stretches it too much anyway.
Now I would like to know when the pinch ended with the image 10% smaller than the minimum scaling size and, in this case, prevent failures and cause another animation that compresses the image to “close”. This. Thus, it can be kind of “pinch to close” gesture. What I came up with to do this, in its simplest way, is the following:
- (void)scrollViewDidZoom:(UIScrollView *)scrollView {
if (self.zoomBouncing && zoomedToScale / self.minimumZoomScale < 0.90) {
self.minimumZoomScale = zoomedToScale;
[self shrinkImageToNothing];
} else {
zoomedToScale = self.zoomScale;
}
}
This works great, except that at that moment it is already bouncing, so the setup minimumZoomScaledoes nothing. Thus, rebound and compression occur simultaneously, which, as you can imagine, looks rather strange.
, : ? UIScrollViewDelegate, - , , UIScrollView . , :
nil –viewForZoomingInScrollView:, 90% - . , , , .bouncesZoom -scrollViewDidZoom: false, 90%, true, 90%. , 90%, , bouncesZoom .-touchesEnded:withEvent. .- UIPinchGestureRecognizer UIScrollView. , ( ) UIScrollView, , . , . - , UIScrollView , .
, . - - ?