• Stars
    star
    254
  • Rank 160,264 (Top 4 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

SMScrollView is a subclass of UIScrollView with extended functionality such as centering zoomed view, double-tap to zoom, scale to fit and more.

SMScrollView

Version License Platform

SMScrollView is a subclass of UIScrollView with extended functionality such as centering zoomed view, double-tap to zoom, scale to fit and more.

Installation

SMScrollView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SMScrollView"

If you are not using CocoaPods, then just copy files from Pod/Classes to your project.

Description

  • SMScrollView maintains the position of its zooming view returned by its delegate's viewForZoomingInScrollView: in the center of its own boundaries. center-zooming-view
  • SMScrollView has double-tap gesture to zoom in and out its zooming view. 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 behaviour. double-tap-to-zoom
  • When SMScrollView's bounds are 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 content is never stretched. fit-on-size-change
    2. If fitOnSizeChange == NO, then the content point that was displayed in the center of its bounds before the size change, is kept in center after the size change. 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. maintain-center-point

License

SMScrollView is available under the MIT license. See the LICENSE file for more info.