XLPagerTabStrip 0,11,2,2,7,4,5 CocoaPods

Android PagerTabStrip for iOS.

XLPagerTabStrip

Build status Platform iOS Swift 3 compatible Carthage compatible CocoaPods compatible License: MIT

Made with ❤️ by XMARTLABS.

Android PagerTabStrip for iOS!

XLPagerTabStrip is a Container View Controller that allows us to switch easily among a collection of view controllers. Pan gesture can be used to move on to next or previous view controller. It shows a interactive indicator of the current, previous, next child view controllers.

Getting involved

  • If you want to contribute please feel free to submit pull requests.
  • If you have a feature request please open an issue.
  • If you found a bug or need help please check older issues, FAQ and threads on StackOverflow (Tag ‘XLPagerTabStrip’) before submitting an issue.

Before contribute check the CONTRIBUTING file for more info.

If you use XLPagerTabStrip in your app We would love to hear about it! Drop us a line on twitter.

Pager Types

The library provides 4 different ways to show the view controllers.

Button Bar

This is likely to be the most common pager type. It’s used by many well known apps such as instagram, youtube, skype and many others.

Bar

This mode doesn’t show a title neither an image. It only shows a bar that indicates the current view controller.

Twitter

Long time ago twitter app made use of this type of pager in the app main screen.

Segmented

This mode uses a UISegmentedControl to indicates which is the view controller being displayed.

Usage

Basically we just need to provide the list of child view controllers to show and these view controllers should provide the information (title or image) that will be shown in the associated indicator.

Let’s see the steps to do this:

Choose which type of pager we want to create

First we should choose the type of pager we want to create, depending on our choice we will have to create a view controller that extends from one of the following controllers: TwitterPagerTabStripViewController, ButtonBarPagerTabStripViewController, SegmentedPagerTabStripViewController, BarPagerTabStripViewController.

All these build-in pager controllers extend from the base class PagerTabStripViewController. You can also make your custom pager controller by extending directly from PagerTabStripViewController in case no pager menu type fits your needs.

import XLPagerTabStrip

class MyPagerTabStripName: ButtonBarPagerTabStripViewController {
  ..
}
Connect outlets and add layout constraints

We strongly recommend to use IB to set up our page controller views.

Drag into the storyboard a UIViewController and set up its class with your pager controller (MyPagerTabStripName). Drag a UIScrollView into your view controller view and connect PagerTabStripViewController containerView outlet with the scroll view.

Depending on which type of paging view controller you are working with you may have to connect more outlets.

For BarPagerTabStripViewController we should connect barView outlet. barView type is UIView. ButtonBarPagerTabStripViewController requires us to connect buttonBarView outlet. buttonBarView type is ButtonBarView which extends from UICollectionView. SegmentedPagerTabStripViewController has a segmentedControl outlet, if the outlet is not connected the library try to set up the navigationItem titleView property using a UISegmentedControl. TwitterPagerTabStripViewController doesn’t require us to connect any additional outlet.

The example project contains a example for each pager controller type and we can look into it to see how views were added and how outlets were connected.

Provide the view controllers that will appear embedded into the PagerTabStrip view controller

You can provide the view controllers by overriding func viewControllers(for: pagerTabStripController: PagerTabStripViewController) -> [UIViewController] method.

override public func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
  return [MyEmbeddedViewController(), MySecondEmbeddedViewController()]
}

The method above is the only method declared in PagerTabStripDataSource protocol. We don’t need to explicitly conform to it since base pager class already does it.

Provide information to show in each indicator

Every UIViewController that will appear within the PagerTabStrip needs to provide either a title or an image. In order to do so they should conform to IndicatorInfoProvider by implementing func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo which provides the information required to show the PagerTabStrip menu (indicator) associated with the view controller.

class MyEmbeddedViewController: UITableViewController, IndicatorInfoProvider {

  func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
    return IndicatorInfo(title: "My Child title")
  }
}

For a detailed step by step guide about how to use the library, please check out this community blog post.

That’s it! We’re done!

Related Repositories

XLPagerTabStrip

XLPagerTabStrip

Android PagerTabStrip for iOS. ...

XLPagerTabStrip

XLPagerTabStrip

Android PagerTabStrip for iOS. ...

XLPagerTabStrip

XLPagerTabStrip

Android PagerTabStrip for iOS. ...


Top Contributors

mtnbarreto mats-claassen pastorin michaelEllisUy xhzengAIB OliverPearmain santiagofm nayzak jamesjychong antrix1989 gcutrini colemancda HelOlhausen DanielMandea mrcly mad102190 mcousillas6 m-revetria chancyWu gali8 monoqlo tailec

Releases

-   v2.0.0 zip tar
-   v1.1.1 zip tar
-   v1.1.0 zip tar
-   v1.0.0 zip tar
-   6.0.0 zip tar
-   5.1.0 zip tar
-   5.0.0 zip tar
-   4.0.2 zip tar
-   4.0.1 zip tar
-   4.0.0 zip tar
-   3.0.0 zip tar