please help me...i want add view controllers and tab text based on my server response... there is no fixed no.. how do i do that
Im currently trying to find a solution for this too.
Like for a UITableView, there is a function to reload the pager.
Just call reloadPagerTabStripView() after you received your data from your server and initialized your UIViewController in func viewControllers(for pagerTabStripController: PagerTabStripViewController)
I have same issue.
we are not able to create dynamic child view in this.
If any body find solution than please help me.
I am stuck in this problem.
This is throwing "Fatal error: Index out of range" when calling reloadPagerTabStripView() function after updating the controllers.
The file and line of crash is:
ButtonBarPagerTabStripViewController.swift -> collectionView(_: UICollectionView, layout: UICollectionViewLayout, sizeForItemAtIndexPath: IndexPath) method's first statement:
guard let cellWidthValue = cachedCellWidths?[indexPath.row]
Potential fix here:
https://github.com/xmartlabs/XLPagerTabStrip/issues/388
Just create an EmptyChildViewController.swift:
import UIKit
import XLPagerTabStrip
class EmptyChildViewController: UIViewController, IndicatorInfoProvider {
override func viewDidLoad() {
super.viewDidLoad()
// do nothing
}
func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
return IndicatorInfo(title: "")
}
}
set empty child view when your data in not ready
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
if data.count > 0 {
// get datas
return [childVC]
}
let empty = EmptyChildViewController()
return [empty]
}
I was able to achieve this, https://stackoverflow.com/a/56563002/9704569
Like for a UITableView, there is a function to reload the pager.
Just callreloadPagerTabStripView()after you received your data from your server and initialized your UIViewController infunc viewControllers(for pagerTabStripController: PagerTabStripViewController)
How can you make the dynamically created view controller instance conform to the IndicatorInfoProvider protocol?
Most helpful comment
I have same issue.
we are not able to create dynamic child view in this.
If any body find solution than please help me.
I am stuck in this problem.