Latest 1.4.0
Homepage https://github.com/lihei12345/MTOPagerViewController
License MIT
Platforms ios 8.0, requires ARC
Authors

MTORefresher is a iOS Container View Controller, like View Pager in Android.

Install

Now Support Swift 3:

pod 'MTOPagerViewController', '~> 1.0.0'
# Optional
pod 'MTOPagerViewController/PagerMenuView', '~> 1.0.0'

For Swift 2.x:

pod 'MTOPagerViewController', '~> 0.1.1'
# Optional
pod 'MTOPagerViewController/PagerMenuView', '~> 0.1.1' 

Demo

Screenshot

1.create MTOPagerViewController


fileprivate lazy var pagerMenuView: PagerMenuView = {
    let view = PagerMenuView(titles: ["History", "Favor"])
    view.highlightImageWidth = 65
    return view
}()

fileprivate lazy var pagerVC: MTOPagerViewController = {
    let pager = MTOPagerViewController(delegate: self, menu: self.pagerMenuView)
    return pager
}()

2.MTOPagerDelegate

// MARK: - MTOPagerDelegate

func mtoNumOfChildControllers(pager: MTOPagerViewController) -> Int {
    return 2
}

func mto(pager: MTOPagerViewController, didSelectChildController index: Int) {
    // do something
}

func mto(pager: MTOPagerViewController, childControllerAtIndex index: Int) -> UIViewController {
    if index == 0 {
        return historyVC
    } else {
        return favorVC
    }
}

3.add to parent view controller

override func viewDidLoad() {
    super.viewDidLoad()

    self.title = "MTOPagerViewController"

    self.edgesForExtendedLayout = UIRectEdge()
    self.view.addSubview(pagerMenuView)

    addChildViewController(pagerVC)
    self.view.addSubview(pagerVC.view)
}

Latest podspec

{
    "name": "MTOPagerViewController",
    "version": "1.4.0",
    "summary": "MTORefresher is a Swift implementation of View Pager",
    "description": "MTORefresher is a Swift implementation of View Pager. It's completed by iOS Container View Controller. You can custom your own menu view.",
    "homepage": "https://github.com/lihei12345/MTOPagerViewController",
    "license": "MIT",
    "authors": {
        "lifuqiang": "[email protected]"
    },
    "source": {
        "git": "https://github.com/lihei12345/MTOPagerViewController.git",
        "tag": "1.4.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "default_subspecs": "Core",
    "pushed_with_swift_version": "3.0",
    "subspecs": [
        {
            "name": "Core",
            "source_files": "Source/*.swift",
            "frameworks": "UIKit"
        },
        {
            "name": "PagerMenuView",
            "source_files": "PagerMenuView/*.swift",
            "dependencies": {
                "MTOPagerViewController/Core": []
            }
        }
    ]
}

Pin It on Pinterest

Share This