A powerful paging view controller with indicator bar
Tabman
Tabman is a powerful paging view controller with indicator bar, for iOS.
Features
- [x] Super easy to implement page view controller with indicator bar.
- [x] Multiple indicator bar styles.
- [x] Simplistic, yet highly extensive customisation.
- [x] Full support for custom components.
- [x] Built on a powerful and informative page view controller, Pageboy.
For details on using older versions of Tabman or Swift please see Compatibility
Installation
CocoaPods
Tabman is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'Tabman', '~> 1.0'
And run pod install
.
Example
A nice pretty example project is available to take a look at some of the features that Tabman
offers. To run the example, simply clone the repo, run
carthage bootstrap --platform ios
and build the workspace.
Usage
Getting Started
- Create an instance of
TabmanViewController
and provide it with aPageboyViewControllerDataSource
, also configuring the items you want to display in theTabmanBar
. Note:TabmanViewController
conforms to and is set as thePageboyViewControllerDelegate
.
class YourTabViewController: TabmanViewController, PageboyViewControllerDataSource {
override func viewDidLoad() {
super.viewDidLoad()
self.dataSource = self
// configure the bar
self.bar.items = [Item(title: "Page 1"),
Item(title: "Page 2")]
}
}
- Implement
PageboyViewControllerDataSource
.
func numberOfViewControllers(in pageboyViewController: PageboyViewController) -> Int {
return viewControllers.count
}
func viewController(for pageboyViewController: PageboyViewController,
at index: PageboyViewController.PageIndex) -> UIViewController? {
return viewControllers[index]
}
func defaultPage(for pageboyViewController: PageboyViewController) -> PageboyViewController.Page? {
return nil
}
- All done! ?
Child Content Insetting
Tabman will automatically inset any UITableView
or UICollectionView
's that are in the child view controllers provided to the PageboyViewControllerDataSource
. This behaviour can easily be disabled:
tabmanViewController.automaticallyAdjustsChildScrollViewInsets = false
A requiredInsets
property is also available on TabmanBarConfig
which provides any insets required to inset content correctly for the visible TabmanBar
manually.
Customisation
The TabmanBar
in Tabman can be completely customised to your liking, by simply modifying the available properties in the .bar
TabmanBar.Config
object.