SMScrollView for iOS

Download Source

SMScrollView is a subclass of UIScrollView with the following additions:

  • It maintains the position of the view returned by its delegate's viewForZoomingInScrollView: in the center of its own boundaries.
  • It has a double-tap gesture to zoom in and out the view returned by its delegate's viewForZoomingInScrollView:. Specifically, when its zoomScale == minimumZoomScale, it zooms-in the view to the tapped point and to the scale defined by by the maximumZoomScale. Otherwise, when zoomScale > minimumZoomScale, it zooms-out to a scale defined by the minimumZoomScale. The double-tap gesture is available through the doubleTapGestureRecognizer property to disable or adjust the gesture behavior.
  • When its size is changed, for example due to a change in an interface orientation, then:
    1. If its fitOnSizeChange == YES, then its content is rescaled to fit its new size, up to the scale of 1.0, such that the content is never stretched.
    2. If fitOnSizeChange == NO, then it maintains zoomed view's center point in center after the size is changed. However, if stickToBounds property was set to YES and the scroll-view was scrolled to one of its boundaries before the size change, then it is kept at these boundaries instead of keeping the center point in center.

License: MIT

Language: Objective-C

Platform: iOS

Sponsored with ❤️ by Instabug
Why do mobile-first companies choose Instabug over Crashlytics

Instabug helps you identify and resolve severe crashes quickly. You can retrace in-app events and know exactly which line of code caused the crash along with environment details, network logs, repro steps, and the session profiler. Ask more questions or keep users up-to-date with in-app replies straight from your dashboard. We take data privacy seriously, so no one sees your data but you!