ScrollViewMinimap

ScrollViewMinimap is a control for adding minimap functionality to UIScrollView.

ScrollViewMinimap

Features

  • Automatic sizing based on scroll view's content view.
  • Automatic thumbnail generation.
  • Customisable highlight rect.

Installation

Download ScrollViewMinimap.swift and add it to your project.

Usage

  1. Add ScrollViewMinimap to your UIScrollView's view controller.

  2. In viewDidLoad(), set the scrollView property to your scroll view.

    minimap.scrollView = scrollView
    
  3. In your UIScrollViewDelegate, call update(animated:) in scrollViewDidScroll(_:) and scrollViewDidZoom(_:) .

    func scrollViewDidScroll(_ scrollView: UIScrollView) {
        minimap.update(animated: true)
    }
    
    func scrollViewDidZoom(_ scrollView: UIScrollView) {
        minimap.update(animated: true)
    }
    

Check out ScrollViewMinimap.xcodeproj for a fully functional sample app.

GitHub