A paging indicator like Apple Store app.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
StoreScrollIndicator
images
.gitignore
LICENSE
README.md

README.md

StoreScrollIndicator

A paging indicator like Apple Store app.

Apple Store App:

Summary

  • iOS 9.3 and later
  • Swift 3
  • Xcode 8 (Sample Project)

Usage

1. Copy ScrollIndicatorView.swift to your project

  • ScrollIndicatorView.swift
  • StackedIndicatorView.swift
    • Stacked style

2. Put the ScrollIndicatorView / StackedIndicatorView

Put the custom view on a nib, then set Class as ScrollIndicatorView or StackedIndicatorView.

Also initializable from your code.

3. Set properties

scrollIndicatorView.numberOfPages = 5
scrollIndicatorView.style = .marker   // Marker Style
scrollIndicatorView.style = .progress // Progress Style
scrollIndicatorView.style = .autoProgress // Timer Style
scrollIndicatorView.indicatorColor = UIColor.orange // Indicator Color

4. Implement UIScrollViewDelegate

  • To fade in effect
    • scrollViewDidScroll()
  • To fade out effect
    • scrollViewDidEndDragging()
    • scrollViewDidEndDecelerating()
    • scrollViewDidEndScrollingAnimation()
func scrollViewDidScroll(_ scrollView: UIScrollView){
	scrollIndicatorView.scrollToOffsetOf(scrollView: scrollView)
	
	if scrollView.isTracking || scrollView.isDragging {
		scrollIndicatorView.fadeIn()
	}
}

func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
	scrollIndicatorView.fadeOut()
}

func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
	scrollIndicatorView.fadeOut()
}

func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) {
	scrollIndicatorView.fadeOut()
}

License

See LICENSE (MIT) for details.