Giter Club home page Giter Club logo

jdslider's Introduction

JDSlider

Version License Platform

Preview
Beetripper App's screenshots

Example Project

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

Installation

CocoaPods

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

pod "JDSlider"

Manual

Clone the repository:

$ git clone https://github.com/JellyDevelopment/JDSlider.git

Drag and drop JDSlider.swift file into your project. Add import JDSlider to all view controllers that need to use it.

##Usage

  • Create an UIView in Interface Builder and change to JDSliderView class.
  • Set the Slider's Delegate and Datasource
class ViewController: UIViewController, JDSliderDataSource, JDSliderDelegate {

    //MARK: @IBOutlet
    @IBOutlet var sliderView: JDSliderView!
    
    //MARK: LifeCycle
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        self.sliderView.delegate    = self
        self.sliderView.datasource  = self
    }
}
  • Implement JDSliderDataSource, JDSliderDelegate
//MARK: JDSliderDelegate
func slider(jdSlider: JDSliderView, didSelectSlideAtIndex index: Int) {
   print("Touch slide with index: \(index)")
}
   
//MARK: JDSliderDataSource
func slider(jdSliderNumberOfSlides slider: JDSliderView) -> Int {
   return self.arrayImages.count
}
    
func slider(jdSlider: JDSliderView, viewForSlideAtIndex index: Int) -> UIView {
   let imageView = UIImageView()
   imageView.image = UIImage(named: self.arrayImages[index])
            
   return imageView
}
  • You can customize the page indicator's color
self.sliderView.tintPageIndicator(UIColor.orangeColor(), state: .Highlight)
self.sliderView.tintPageIndicator(UIColor.blackColor(), state: .Normal)

Author

License

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

jdslider's People

Contributors

davidlcarrascal avatar

Watchers

woshizilong avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.