iOS页面控制:PageController
jopen
9年前
PageController 是无限页面控制器,可以滚动内容和标题栏,而且带有滚动延迟功能。
Requirements
- iOS 8.0+
Features
- To inherit from DCScrollView
- UseUIViewController, notUIViewlikeUITabBarController
- Scrolling smoothly and effortlessly
- Support AutoLayout about MenuCell
- Handling to change current view controller with Delegate.
Installation
CocoaPods
CocoaPods is a dependency manager for Cocoa projects.
To integrate PageController into your Xcode project using CocoaPods, specify it in yourPodfile:
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] { var viewControllers = [UIViewController]() let names = [ "Home", "Innovation", "Technology", "Life", ] for name in names { let viewController = ItemsCollectionViewController() viewController.title = name viewControllers.append(viewController) } } }