Latest 1.0.1
Homepage https://github.com/policante/PageControl
License MIT
Platforms ios 8.3
Authors

Version
License
Platform

A simple way to navigate between pages by using gestures

Demo image

Example

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

Requirements

  • iOS 8.3 or higher

Installation

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

pod 'PageControl'

Usage

In your storyboard, add a container view of the type PageControlViewController

example1 image

self.pageController.delegate = self
self.pageController.dataSource = self

extension ViewController: PageControlDelegate {
  func pageControl(_ pageController: PageControlViewController, atSelected viewController: UIViewController) {
    (viewController as! CardItemViewController).animateImage()
  }

  func pageControl(_ pageController: PageControlViewController, atUnselected viewController: UIViewController) {
  }   
}

extension ViewController: PageControlDataSource {
  func numberOfCells(in pageController: PageControlViewController) -> Int {
    return self.dataController.count
  }

  func pageControl(_ pageController: PageControlViewController, cellAtRow row: Int) -> UIViewController! {
    return self.dataController[row]
  }

  func pageControl(_ pageController: PageControlViewController, sizeAtRow row: Int) -> CGSize {
    let width = pageController.view.bounds.size.width - 20
    if row == pageController.currentPosition {
      return CGSize(width: width, height: 500)
    }
    return CGSize(width: width, height: 500)
  }

}

If you need to change the page manually, use:


self.pageController.currentPosition = index

self.pageController.nextPage()

self.pageController.previousPage()

Author

Rodrigo Martins, [email protected]

License

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

Latest podspec

{
    "name": "PageControl",
    "version": "1.0.1",
    "summary": "A simple way to navigate between pages by using gestures.",
    "description": "A simple way to navigate between pages by using gestures.nMade with love",
    "homepage": "https://github.com/policante/PageControl",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Rodrigo Martins": "[email protected]"
    },
    "source": {
        "git": "https://github.com/policante/PageControl.git",
        "tag": "1.0.1"
    },
    "platforms": {
        "ios": "8.3"
    },
    "source_files": "PageControl/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This