TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Nov 2017 |
Maintained by Anthony Miller, Jett Farmer.
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.
XLPagerTabStrip was originally inspired by Tell market app.
XLPagerTabStrip helps us deal with view controllers that have the same relevance for the user like Android PagerTabStrip and PageView do. Since you're able to navigate between a large amount of view controllers, XLPagerTabStrip is an scalable and nice solution for this problem.
Integrate XLPagerTabStrip
is as easy as following these steps:
Create a UIViewController class that should extend from either XLSegmentedPagerTabStripViewController
, XLBarPagerTabStripViewController
, XLButtonBarPagerTabStripViewController
, XLTwitterPagerTabStripViewController
.
The recently created concrete view controller should conform to XLPagerTabStripViewControllerDataSource
implementing: -(NSArray *)childViewControllersForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController;
(Recomended) Set up your view controllers using a nib file or a Storyboard. We need to connect some IBOutlets (take a look at the Demo folder).
Enjoy!
For further details take a look at the Demo folder to see the code of examples shown above.
#####How to change the visible child view controller programmatically
XLPagerTabStripViewController
provides the following methods to programmatically change the visible child view controller:
-(void)moveToViewControllerAtIndex:(NSUInteger)index;
-(void)moveToViewControllerAtIndex:(NSUInteger)index animated:(BOOL)animated;
-(void)moveToViewController:(UIViewController *)viewController;
-(void)moveToViewController:(UIViewController *)viewController animated:(BOOL)animated;
#####How to change the selected tab (XLButtonBarViewCell) look and feel based on the selected state
XLButtonBarPagerTabStripViewController
provides a flexible way to customize the look and feel of a XLButtonBarViewCell
based on the selected state by using blocks. These blocks will be called each time the current cell index changes its value.
@property (copy) void (^changeCurrentIndexProgressiveBlock)(XLButtonBarViewCell* oldCell, XLButtonBarViewCell *newCell, CGFloat progressPercentage, BOOL indexWasChanged, BOOL animated);
@property (copy) void (^changeCurrentIndexBlock)(XLButtonBarViewCell* oldCell, XLButtonBarViewCell *newCell, BOOL animated);
Since the collection cell (tab) is passed as a parameter you have full control on the look and fell change and animation.
The easiest way to use XLPagerTabStrip
in your app is via CocoaPods.
pod 'XLPagerTabStrip', '~> 2.0'
.pod install
from the Podfile folder directory.The most interesting customizable features are:
skipIntermediateViewControllers
property)barButtonView.selectedBarAlignment
property)Version 3.0.0
selectedBarAlignment
added to XLButtonBarView
.shouldCellsFillAvailableWidth
added to XLButtonBarView
.Version 2.0.0
changeCurrentIndexProgressiveBlock
added to XLButtonBarPagerTabStripViewController
.changeCurrentIndexBlock
added to XLButtonBarPagerTabStripViewController
.-(void)pagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController updateIndicatorFromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex withProgressPercentage:(CGFloat)progressPercentage indexWasChanged:(BOOL)indexWasChanged;
Version 1.1.1
Version 1.1.0
Version 1.0.0
Any suggestion or question? Please create a Github issue or reach us out.