I have been following the XLpagerTabStrip cocoapods extension to set up a tab bar at the top of my view controller (https://github.com/xmartlabs/XLPagerTabStrip). I am implementing the ButtonBarPagerTabStripViewController and have followed the steps exactly, but the UIScrollView is not displaying the child view controllers.
I think this is because in the example the child view controllers are set up programmatically rather than in the storyboard, whereas mine are currently set up in the storyboard, and hence are displaying no content, yet there is no way that I can see to connect the child view controllers to the ButtonBarController via the storyboard.
Is there a way to display the child view controllers using the storyboard, or must it be done programmatically?
The GitHub page says to implement the following function (But this doesnt seem to work if your child view controllers are set up via the storyboard):
override public func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController]
{
return [MyChildViewController(), MySecondChildViewController()]
}
You need to load controller from storybard:
override public func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController]
{
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let childOneVC = storyboard.instantiateViewControllerWithIdentifier("childOneVC")
let childTwoVC = storyboard.instantiateViewControllerWithIdentifier("childTwoVC")
return [childOneVC, childTwoVC]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With