I am using XLPagerTabStrip, I have a Scrollview and a collectionView name Container and ButtonBarView respectively . Everything is working fine except Tab item Visibility . I want something like Tabs equaly dividing tabs.
Parant controller code is :
import UIKit
import XLPagerTabStrip
class ParentViewController: ButtonBarPagerTabStripViewController {
let purpleInspireColor = UIColor(red:0.13, green:0.03, blue:0.25, alpha:1.0)
override func viewDidLoad() {
super.viewDidLoad()
self.edgesForExtendedLayout = []
// change selected bar color
settings.style.buttonBarBackgroundColor = .white
settings.style.buttonBarItemBackgroundColor = .white
settings.style.selectedBarBackgroundColor = purpleInspireColor
settings.style.buttonBarItemFont = .boldSystemFont(ofSize: 14)
settings.style.selectedBarHeight = 2.0
settings.style.buttonBarMinimumLineSpacing = 0
settings.style.buttonBarItemTitleColor = .black
settings.style.buttonBarItemsShouldFillAvailiableWidth = 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 = .black
newCell?.label.textColor = self?.purpleInspireColor
}
}
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
let included = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "IncludedViewController")
let premium = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "PremiumViewController")
// let luxury = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "LuxuryViewController")
return [included,premium]
}
}
I have two tabs named Included and Premium.
I found answer on this question
go to pod file in Xcode project. Change UICollectionViewDelegate to UICollectionViewDelegateFlowLayout.
class ButtonBarPagerTabStripViewController: PagerTabStripViewController, PagerTabStripDataSource, PagerTabStripIsProgressiveDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout