XLPagerTabStrip
XLPagerTabStrip copied to clipboard
When pager loads for the first time view in first childViewController leaves space from both side for the first time.
when pager loads tableview in the first child view controller leaves space from both sides but if I switched tabs then it acquires the screen as I wanted.
here is the screenshot of a simulator for understanding:
And after switching tabs and as expected:
my whole setup is normal tableview has nothing done in that its just a view and here is XKPager setup
settings.style.buttonBarBackgroundColor = appBlueColor
settings.style.buttonBarItemBackgroundColor = appBlueColor
settings.style.selectedBarBackgroundColor = appBrownColor
settings.style.buttonBarItemFont = UIFont.appRegularFontWith(size: 16)
settings.style.selectedBarHeight = 4.0
settings.style.buttonBarMinimumLineSpacing = 0
settings.style.buttonBarItemTitleColor = .black
settings.style.buttonBarItemsShouldFillAvailableWidth = true
settings.style.buttonBarLeftContentInset = 0
settings.style.buttonBarRightContentInset = 0
changeCurrentIndexProgressive = { [weak self] (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in
guard changeCurrentIndex == true else { return }
oldCell?.label.textColor = self?.oldCellColor
oldCell?.label.font = UIFont.appRegularFontWith(size: 16)
newCell?.label.textColor = .white
newCell?.label.font = UIFont.appMediumFontWith(size: 16)
}
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
let child1 = UIStoryboard(name: "Home", bundle: nil).instantiateViewController(withIdentifier: "childViewController1")
let child2 = UIStoryboard(name: "Home", bundle: nil).instantiateViewController(withIdentifier: "childViewController1")
let child3 = UIStoryboard(name: "Home", bundle: nil).instantiateViewController(withIdentifier: "childViewController1")
return [child1, child2, child3]
}
Xcode version: 11.2.1 swift version: 5 ios deployment target: 10.0 XLPager updated
I also have a similar issue but in my case the view controller overflows the container.
As a temporary solution I reload the XLPager in the viewDidAppear() method using self.reloadPagerTabStripView() but this results in a repetitive API call which is very disturbing 😔😔
I also have a similar issue , and use self.reloadPagerTabStripView()
@harshpanchal-silverwing rather than including self.reloadPagerTabStripView()
in viewDidAppear()
reload you pagerstripview in viewWillAppear
like
override func viewWillAppear(_ animated: Bool) {
setupNav()
self.reloadPagerTabStripView()
}
this will solve the repetitive API call issues. Thanks for the solution.
Managed to solve the issue on my side by using this,
DispatchQueue.main.async { self.moveToViewController(at: 0) }