Please note, this blog entry is from a previous course. You might want to check out the current one.
Whenever a photo’s image appears on screen, it should automatically zoom to show as much of the photo as possible with no extra, unused space. Once the user zooms in or out on a photo by pinching, though, you can stop auto-zooming that image.
Instead of setting the zoom scale to a constant value, it needs to be calculated. The scale to fit an image horizontally is calculated by dividing the bounds width of the scroll view by the width of the image. The same would have been true for the vertical scale, using the heights of those values, if the scroll view did not extend over the tab bar, the navigation bar and the status bar. Their heights need to be used to adjust the calculation for the vertical scale. Just set the the zoom scale of the scroll view to the higher of those two calculated scales:
Continue reading “cs193p – Assignment #5 Task #8”