ScrollViewMinimap
ScrollViewMinimap is a control for adding minimap functionality to UIScrollView.
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
-
Add
ScrollViewMinimap
to yourUIScrollView
's view controller. -
In
viewDidLoad()
, set thescrollView
property to your scroll view.minimap.scrollView = scrollView
-
In your
UIScrollViewDelegate
, callupdate(animated:)
inscrollViewDidScroll(_:)
andscrollViewDidZoom(_:)
.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.