Latest 0.1.2
Homepage https://github.com/gkye/GKAutoScrollingView
License MIT
Platforms ios 8.0
Frameworks UIKit
Authors

codebeat badge
Version
License
Platform

A customizable, easy to use infinite scroll view similar to the App Store banner.

Demo

Installation

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

pod "GKAutoScrollingView"

Example

Check out the demo.

Usage

1: Add AutoScrollingView to your UIViewController.
2: Set dataSource and delegate (optional)

class ViewController: UIViewController, AutoScrollingViewDataSource, AutoScrollingViewDelegate {
  var autoScrollView: AutoScrollingView!

  override func viewDidLoad() {
    super.viewDidLoad()
    autoScrollView = AutoScrollingView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 300))
    autoScrollView.dataSource = self
    autoScrollView.delegate = self
    self.view.addSubview(autoScrollView)
  }

}

3: Conform to AutoScrollingView dataSource

extension MyViewController: AutoScrollingViewDataSource{
  func autoScrollingViewNumberOfViews(autoScrollView: GKAutoScrollingView) -> Int {
    return 4
  }

  func autoScrollingView(autoScrollView: GKAutoScrollingView, viewForIndex index: Int) -> UIView {
    let img: UIImageView = UIImageView(image: UIImage(named: "(index)"))
    return img
  }
}

4: Conform to AutoScrollingView delegate (all optional)

extension MyViewController: AutoScrollingViewDelegate{
  func autoScrollingView(autoScrollingView: AutoScrollingView, didSelectItem index: Int) {
    print("did select")
  }

  func autoScrollingView(autoScrollingView: AutoScrollingView, didChangeStatus status: ScrollingState) {
    print(status.rawValue)
  }

  func autoScrollingView(autoScrollingView: AutoScrollingView, didAutoScroll index: Int) {
    print("auto scrolling at index ", index)
  }
}

Protocols

DataSource

Return an UIView to be used at the current index

  func autoScrollingView(autoScrollView: GKAutoScrollingView, viewForIndex index: Int)->UIView

Set number of UIView‘s within GKAutoScrollingView

  func autoScrollingViewNumberOfViews(autoScrollView: GKAutoScrollingView)->Int

Delegate

Returns the index of the selected view

optional func autoScrollingView(autoScrollingView: AutoScrollingView, didSelectItem index: Int)

Returns the index of currentItem before view is scrolled

optional func autoScrollingView(autoScrollingView: AutoScrollingView, didAutoScroll index: Int)

Returns an AutoScrollingView the status of the scroll automation. (Unpaused or Paused

optional func autoScrollingView(autoScrollingView: AutoScrollingView, didChangeStatus status: ScrollingState)

Methods

Stops the automation of the ScrollView

pauseScrolling()

Starts the automation of scrolling (if scrolling is paused)

startScrolling()

Properties

Set the interval between autoScrolling. Default is 2.0 seconds.

public var timerInterval: Double!

License

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

Latest podspec

{
    "name": "GKAutoScrollingView",
    "version": "0.1.2",
    "summary": "A customizable, easy to use infinite scroll view similar to the App Store banner.",
    "description": "A customizable, easy to use infinite scroll view similar to the App Store banner. GKAutoScrollingView offers numerous protocols and properties for customization.",
    "homepage": "https://github.com/gkye/GKAutoScrollingView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "=": "George Kye"
    },
    "source": {
        "git": "https://github.com/gkye/GKAutoScrollingView.git",
        "tag": "0.1.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Source/**/*",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This