Latest 1.0.0
Homepage https://github.com/tzef/BmoViewPager
License MIT
Platforms ios 8.0
Frameworks UIKit
Authors

CI Status
Version
License
Platform

A ViewPager with NavigationBar component based on UIPageViewController and UICollectionView, which is a convenience way to supply and manager each viewController.

I want to make UIPageViewController more intuitive for using it, like UITableView, and supply a navigationBar quickly and simply.

More importantly, when UIPageViewController scroll continuously, pageControl sometimes will get wrong index, this viewPager can help you solve it.

There are some standard dataSource and delegate implemented for generating each page and navigationBar, each of these classes have simple sample code showing in the Pod Example for BmoViewPager.

Simple Usage

Create a UIView extend BmoViewPager

Implement BmoViewPagerDataSource

give page count and each page controller, just like using tableView

func bmoViewPagerDataSourceNumberOfPage(in viewPager: BmoViewPager) -> Int {
    return YourPageCount
}
func bmoViewPagerDataSource(_ viewPager: BmoViewPager, viewControllerForPageAt page: Int) -> UIViewController {
    return YourPageViewController
}

With a NavigationBar

Create a UIView extend BmoViewPagerNavigationBar

Assign a BmoViewPager to the BmoViewPagerNavigationBar

using default style, only need to give the each page title

func bmoViewPagerDataSourceNaviagtionBarItemTitle(_ viewPager: BmoViewPager, navigationBar: BmoViewPagerNavigationBar, forPageListAt page: Int) -> String? {
    return YourPageTitleString
}

navigation item title can custom attributed

func bmoViewPagerDataSourceNaviagtionBarItemNormalAttributed(_ viewPager: BmoViewPager, navigationBar: BmoViewPagerNavigationBar, forPageListAt page: Int) -> [String : Any]? {
    return [
        NSForegroundColorAttributeName : UIColor.lightGray,
        NSFontAttributeName : UIFont.systemFont(ofSize: 14.0)
    ]
}
func bmoViewPagerDataSourceNaviagtionBarItemHighlightedAttributed(_ viewPager: BmoViewPager, navigationBar: BmoViewPagerNavigationBar, forPageListAt page: Int) -> [String : Any]? {
    return [
        NSForegroundColorAttributeName : UIColor.red,
        NSFontAttributeName : UIFont.boldSystemFont(ofSize: 14.0)
    ]
}

if you don’t want use default style, you can custom your own background view and highlighted background view

Advanced Usage

Support Vertical and Horizontal direction scroll

BmoNavigationBar Auto Focus (Default is true)

BmoNavigationBar Title can set normal and highlighted attributed style

BmoViewPager infinitScroll (Default is false)

BmoViewPager presentedPageIndex can programmatically assign the present page

Custom NavigationBar animation, you can get scroll progress from BmoViewPagerDelegate

InfiniteScroll Custom NavigationBar animation

PageControl Optimized

native pageController have a default pageControl if you implement the
func presentationCount(for pageViewController: UIPageViewController) -> Int and
func presentationIndex(for pageViewController: UIPageViewController) -> Int
but sometimes the index have a little bug, if you feel the way too, hope it help you

Native PageController continuously scroll continuously scroll using bmoViewPager

Example

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

Requirements

iOS 8.0+
Xcode 8.0+
Swift 3.0+

Installation

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

pod "BmoViewPager"

Author

LEE ZHE YU, [email protected]

License

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

Latest podspec

{
    "name": "BmoViewPager",
    "version": "1.0.0",
    "summary": "A ViewPager with NavigationBar component based on UIPageViewController and UICollectionView",
    "description": "BmoViewPager is a ViewPager with NavigationBar component based on UIPageViewController and UICollectionView, which is a convenience way to supply and manager each viewController.nI want to make UIPageViewController more intuitive for using it, like UITableView, and supply a navigationBar quickly and simply.nMore importantly, when UIPageViewController scroll continuously, pageControl sometimes will get wrong index, this viewPager can help you solve it.nThere are some standard dataSource and delegate implemented for generating each page and navigationBar, each of these classes  have simple sample code showing in the Pod Example for BmoViewPager.",
    "homepage": "https://github.com/tzef/BmoViewPager",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "LEE ZHE YU": "[email protected]"
    },
    "source": {
        "git": "https://github.com/tzef/BmoViewPager.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "BmoViewPager/Classes/**/*",
    "frameworks": "UIKit",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This