Xlpagertabstrip: Storyboard's view is not loaded!

Created on 6 Nov 2017  路  5Comments  路  Source: xmartlabs/XLPagerTabStrip

I created UIViewControllers in storyboard and I connect the aside class like FirstViewController. I created childs in main controller but when call the controllers, all lifecycle is working but the settings that I change in the storyboard (view background colors as you can see) there is nothing happen. I have three UIViewController and they both all have different colors. But when I run, every UIViewControllers is same.
screen shot 2017-11-06 at 7 11 29 pm
screen shot 2017-11-06 at 7 12 15 pm

The view controllers are connected to the class and these class are working but there is nothing change. How can I fix this ?

Most helpful comment

Hi all!
you need to instantiate your viewcontrollers via storyboard:

override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        let childOneVC = storyboard.instantiateViewController(withIdentifier: "StudentInfo")
        let childTwoVC = storyboard.instantiateViewController(withIdentifier: "SiblingInfo")
        return [childOneVC, childTwoVC]
}

and in your view controller add the following:

required init?(coder aDecoder: NSCoder) {
   super.init(coder: aDecoder)
}

All 5 comments

I am having the same issue. Please help.

Hi all!
you need to instantiate your viewcontrollers via storyboard:

override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        let childOneVC = storyboard.instantiateViewController(withIdentifier: "StudentInfo")
        let childTwoVC = storyboard.instantiateViewController(withIdentifier: "SiblingInfo")
        return [childOneVC, childTwoVC]
}

and in your view controller add the following:

required init?(coder aDecoder: NSCoder) {
   super.init(coder: aDecoder)
}

@rauluranga
Thanks, It worked.

@rauluranga Thanks
can i know how to set title.

please add this to Read me file. I was searching for one day...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bishalg picture bishalg  路  5Comments

rkittinger picture rkittinger  路  3Comments

unittesting0 picture unittesting0  路  3Comments

NikhilGangurde picture NikhilGangurde  路  4Comments

fenixsolorzano picture fenixsolorzano  路  4Comments