I have a UIScrollView
and I would like it to only zoom bounce (UIScrollView.bouncesZoom
) when zooming in. If the user tries to zoom out past the minimumZoomScale there is no bouncing animation, however when zooming in there is. The UIScrollView.bouncesZoom
property only allows for true/false, which applies to both zooming in and out. In an ideal scenario, I would like to have something resembling:
UIScrollView.bouncesZoom.forMinimumZoomScale = false
UIScrollView.bouncesZoom.forMaximumZoomScale = true
The reason for this is so a user cannot zoom out to the point where they can see white space around the view, as this degrades from the aesthetics of my application.
Please let me know if you have any further questions. Thank you!
Asked
Active
Viewed 764 times
1

Shruti Thombre
- 989
- 4
- 11
- 27

dcgoss
- 2,147
- 3
- 20
- 31
-
Why not just set the background colour of the scroll view to be the same colour as your child view so nothing is visible? – Abhi Beckert Aug 11 '14 at 03:56
-
@AbhiBeckert Because my child view implements custom drawing, so there are shapes and lines on the screen that distinguish it from any background the scroll view may have. It's a little difficult to explain without a picture, so in essence I'm saying it's not exactly a great option for this scenario – dcgoss Aug 11 '14 at 04:00
-
Then you need to perform additional drawing outside the normal visible area. There are WWDC session videos explaining how to do this. – Abhi Beckert Aug 11 '14 at 04:02
-
@AbhiBeckert I understand that there may be workarounds, however I'm looking for an answer to my original question to see if it's possible. This is just a test app so it's not a big deal if I can't do it. Thank you for the idea though, I'll definitely check that out – dcgoss Aug 11 '14 at 04:06
-
I don't think it's possible but I could be wrong. Also, being able to see the background is what users expect, try it in safari for example. – Abhi Beckert Aug 11 '14 at 04:07
-
@AbhiBeckert But in Safari it only zooms out the page, not the entire application/view. It would look a little weird if the entire view (search bar, toolbar at bottom, etc.) zoomed out – dcgoss Aug 11 '14 at 04:19
1 Answers
0
Boucing only when you zoom in:
-(void)scrollViewDidZoom:(UIScrollView *)scrollView{
[_scrollerPhoto setBouncesZoom:([scrollView zoomScale]>1)];
}

pleshis
- 406
- 5
- 7
-
having a zoom scale greater than one does not mean that you are zooming in. – HHK Oct 26 '17 at 01:09