Skip to content

Infinite paging controller, scrolling through contents and title bar scrolls with a delay

License

Notifications You must be signed in to change notification settings

TunaYangSkey/PageController

 
 

Repository files navigation

PageController

Build-Status CocoaPods Carthage compatible license

PageController is infinite paging controller, scrolling through contents and title bar scrolls with a delay. Then it provide user interaction to smoothly and effortlessly moving. It is for iOS written in Swift.

![sample](Example project/example.gif)

Requirements

  • iOS 8.0+
  • Xcode 7.0+
PageController Xcode Swift
0.2.0 6.4 1.2
0.3.x 7.0+ 2.0
0.4.x 8.0 2.2

Features

  • To inherit from DCScrollView
  • Use UIViewController, not UIView like UITabBarController
  • Support AutoLayout about MenuCell
  • Handling to change current view controller with Delegate.
  • Scrolling smoothly and effortlessly
  • Keep to smoothly in scrolling contents too much

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

To integrate PageController into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'PageController'

Then, run the following command:

$ pod install

Usage

viewControllers

Type is [UIViewController], and element must have title.

import PageController

class CustomViewController: PageController {

    override func viewDidLoad() {
        super.viewDidLoad()

        viewControllers = createViewControllers()
    }

    func createViewControllers() -> [UIViewController] {
        let names = [
            "favorites",
            "recents",
            "contacts",
            "history",
            "more",
        ]

        return names.map { name -> UIViewController in
            let viewController = ContentViewController()
            viewController.title = name
            return viewController
        }
    }
}

MenuBar

Enable to change backgroundColor, frame and MenuCell.

menuBar.backgroundColor = UIColor.whiteColor().colorWithAlphaComponent(0.9)
menuBar.registerClass(CustomMenuCell.self)

MenuCell

  • constentInset

Margins between cells are zero, because it is difficult that calculating distance of scrolling. If you change margins between cell's labels or vertical position, use constentInset.

  • updateData()

If property cell's selected is changed, updateData() is called. You customize animations of activate to dis-activate, or dis-activate to activate, implement as override updateData().

License

PageController is available under the MIT license.

About

Infinite paging controller, scrolling through contents and title bar scrolls with a delay

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 96.8%
  • Ruby 2.2%
  • Objective-C 1.0%