frederik-jacques / TNImageSliderViewController

A Swift image slider component based on UICollectionView
https://the-nerd.be/2015/06/22/tnimagesliderviewcontroller-image-slider-for-swift/
MIT License
90 stars 30 forks source link

TNImageSliderViewController

Version License Platform

What

TNImageSliderViewController is an image slider component written in Swift. It creates a slideshow of images which can slide horizontal or vertical. This component can deal with orientation changes.

Demo

Demo

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

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

pod 'TNImageSliderViewController'

Using storyboards

If you want, you can also set the options property (instance of TNImageSliderViewOptions)

Option What does it do?
scrollDirection Set the collectionview to scroll horizontal or vertical
backgroundColor A UIColor object to set the background color of the collectionview
pageControlHidden Hides the UIPageControl
pageControlCurrentIndicatorTintColor A UIColor object to set the indicator color
pageControlCurrentIndicatorTintColor A UIColor object to set the indicator color
shouldStartFromBeginning Boolean, start at the first picture
imageContentMode UIViewContentMode, How should the images be scaled

Delegate

If you want to be informed that the image slider has scrolled to a specific page, you can set the delegate property. The delegate has one method imageSlider( imageSlider:TNImageSliderViewController, didScrollToPage pageNumber:Int )

Author

Frederik Jacques, frederik@the-nerd.be

License

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