LIHImageSlider is an automatic image slider written in Swift
Clone or download
Latest commit cec8973 Oct 15, 2017
Permalink
Failed to load latest commit information.
Example Readme update Oct 15, 2017
LIHImageSlider Swift 4 compatibility Oct 13, 2017
.swift-version Fixes Feb 20, 2017
LICENSE Updated to Swift 3 Feb 20, 2017
LIHImageSlider.podspec Readme update Oct 15, 2017
README.md Readme update Oct 15, 2017
_Pods.xcodeproj Pod setup Mar 13, 2016

README.md

LIHImageSlider

Version License Platform

Usage

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

Default Slider

let images: [UIImage] = [UIImage(named: "1")!,UIImage(named: "2")!,UIImage(named: "3")!,UIImage(named: "4")!,UIImage(named: "5")!,UIImage(named: "6")!]

let slider1: LIHSlider = LIHSlider(images: images)
slider1.sliderDescriptions = ["Image 1 description","Image 2 description","Image 3 description","Image 4 description","Image 5 description","Image 6 description"]
self.sliderVc1  = LIHSliderViewController(slider: slider1)
sliderVc1.delegate = self
self.addChildViewController(self.sliderVc1)
self.view.addSubview(self.sliderVc1.view)
self.sliderVc1.didMoveToParentViewController(self)
Customized Slider

let slider2: LIHSlider = LIHSlider(images: images)
//customizations
slider2.transitionInterval = 5.0
slider2.transitionStyle = UIPageViewControllerTransitionStyle.PageCurl
slider2.slidingOrientation = UIPageViewControllerNavigationOrientation.Vertical
slider2.sliderNavigationDirection = UIPageViewControllerNavigationDirection.Reverse
slider2.showPageIndicator = false

self.sliderVc2  = LIHSliderViewController(slider: slider2)
self.addChildViewController(self.sliderVc2)
self.view.addSubview(self.sliderVc2.view)
self.sliderVc2.didMoveToParentViewController(self)
Item Click

Implement LIHSliderDelegate

func itemPressedAtIndex(index index: Int) {

}
List of all properties
public var sliderImages: [UIImage]
public var sliderDescriptions: [String] //leave empty to remove description
public var descriptionColor: UIColor  //default is white
public var descriptionBackgroundAlpha: CGFloat //default is 0.3
public var descriptionBackgroundColor: UIColor //default is black
public var descriptionFont: UIFont //default is system font with size 15
public var numberOfLinesInDescription: Int //default is 2
public var transitionInterval: Double //default is 3.0
public var customImageView: UIImageView?
public var showPageIndicator: Bool //default is true
public var userInteractionEnabled: Bool //default is true

//Sliding options
public var transitionStyle: UIPageViewControllerTransitionStyle = UIPageViewControllerTransitionStyle.Scroll
public var slidingOrientation: UIPageViewControllerNavigationOrientation = UIPageViewControllerNavigationOrientation.Horizontal
public var sliderNavigationDirection: UIPageViewControllerNavigationDirection = UIPageViewControllerNavigationDirection.Forward

Requirements

iOS 7+

Installation

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

pod 'LIHImageSlider'

ChangeLog

v1.0.9

Swift 4 Compatibility. Thanks @emre-yilmaz

v1.0.6

User interaction controlls added

v1.0.5

Updated to Swift 3

Author

Lasith Hettiarachchi, lasithih@yahoo.com

License

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