LIHImageSlider 1.0.8

LIHImageSlider 1.0.8

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Feb 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Lasith Hettiarachchi.



  • By
  • Lasith Hettiarachchi

LIHImageSlider

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.6

User interaction controlls added

v1.0.5

Updated to Swift 3

Author

Lasith Hettiarachchi, [email protected]

License

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