DMSegmentedPager
This is a Swift conversion of https://github.com/maxep/MXSegmentedPager
DMSegmentedPager combines DMPagerView with DMSegmentedControl to control the page selection. The integration of DMParallaxHeader allows you to add an parallax header on top while keeping a reliable scrolling effect.
Simple view | Parallax view |
---|---|
Highlight
- DMSegmentedControl is a very customizable control.
- DMParallaxHeader supports any kind of view with different modes.
- DMPagerView lazily loads pages and supports reusable page registration.
- Reliable vertical scroll with any view hierarchy.
- Can load view-controller from storyboard using a custom segue.
Usage
- Adding a parallax header to a DMSegmentedPager is straightforward, e.g:
let headerView = UIImageView(frame: imageFrame)
headerView.image = UIImage(named:"success-baby")
headerView.contentMode = .scaleAspectFill
let segmentedPager = DMSegmentedPager()
segmentedPager.parallaxHeader.view = headerView
segmentedPager.parallaxHeader.height = 150
segmentedPager.parallaxHeader.mode = .fill
segmentedPager.parallaxHeader.minimumHeight = 20
Examples
If you want to try it, simply run:
pod try DMSegmentedPager
Or clone the repo and run pod install
from the Example directory first.
- See DMSimpleViewController for a standard implementation.
- See DMParallaxViewController to implement a pager with a parallax header.
Installation
DMSegmentedPager is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'DMSegmentedPager'
License
DMSegmentedPager is available under the MIT license. See the LICENSE file for more info.