TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Aug 2016 |
SPMSupports SPM | ✗ |
Maintained by Erik LaManna.
The ScrollingTabController provides a tab based container view with navigational tabs at the top and a swipeable content area below. This component follows a similar design and functionality as the Android tab interface. The following features are supported:
The preferred method to install is to use CocoaPods
pod ‘WillowTreeScrollingTabController’
The ScrollingTabController supports instantiation either through InterfaceBuilder or through code and may also easily be subclassed to provide the necessary data and view controllers. The ScrollingTabControllerExample project shows the basic subclassing method of creating the view controller. The basic setup involves the following:
viewControllers
property.Implement the
func tabView(tabView: ScrollingTabController, configureTitleCell cell: UICollectionViewCell, atIndex index: Int) -> UICollectionViewCell?
protocol method of ScrollingTabControllerDataSource to provide the titles for the tabs in the view controller.
There are several options for customizing the tab controller. In addition to the ability to configure the tab cells by implementing the TabDataSource protocol, the ScrollingTabController itself has the following properties to configure appearance:
sizeTabItemsToFit
- Specifies if the tabs should resize to fit the size of the tab titlecenterSelectTabs
- Specifies if the selected tab should remain centered in the viewIn addition, even more customization of the tab bar itself can be had by accessing the tabBar
property of the controller. The tab bar has the following properties to configure appearance.
selectionIndicatorOffset
- Specify the offset of the selection indicator from the bottom of the viewselectionIndicator
- Direct access to change the selection indicator viewselectionIndicatorHeight
- Height of the selection indicatorselectionIndicatorEdgeInsets
- Edge insets for the selection indicatorclassForCell
- Custom class to use for the tabsclassForDivider
- Custom decorator view to use for tab separatorsWhen the view controller specified an initial tab before it was displayed, that tab was not set before the appearance happened. This changes the order so that the tab is selected in viewWillAppear to fix the issue.
We are always open to contributions and pull requests on GitHub. Please follow us at @willowtreeapps on Twitter or http://www.willowtreeapps.com