Skip to content

Instantly share code, notes, and snippets.

@naveedmcs
Forked from iAmrSalman/XLPagerTabStrip.swift
Created September 19, 2019 13:04
Show Gist options
  • Select an option

  • Save naveedmcs/057cad86cb4a18f00bb224d6aa9ff5bd to your computer and use it in GitHub Desktop.

Select an option

Save naveedmcs/057cad86cb4a18f00bb224d6aa9ff5bd to your computer and use it in GitHub Desktop.
[XLPagerTabStrip] #swift #XLPagerTabStrip
import UIKit
import XLPagerTabStrip
class ProfileTabsVC: ButtonBarPagerTabStripViewController {
//MARK: - Life Cycle
override func viewDidLoad() {
setupPager()
super.viewDidLoad()
}
//MARK: - Helpers
fileprivate func setupPager() {
settings.style.buttonBarBackgroundColor = UIColor.red
settings.style.buttonBarItemBackgroundColor = UIColor.red
settings.style.selectedBarBackgroundColor = .white
settings.style.buttonBarItemFont = .boldSystemFont(ofSize: 14)
settings.style.selectedBarHeight = 4.0
settings.style.buttonBarMinimumLineSpacing = 0
settings.style.buttonBarItemTitleColor = .white
settings.style.buttonBarItemsShouldFillAvailiableWidth = true
settings.style.buttonBarLeftContentInset = 0
settings.style.buttonBarRightContentInset = 0
changeCurrentIndexProgressive = { (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in
guard changeCurrentIndex == true else { return }
oldCell?.label.textColor = UIColor(red: 1, green: 1, blue: 1, alpha: 0.7)
newCell?.label.textColor = .white
}
}
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
let viewControllers = [FirstViewController(), SecondViewController(), ThiredViewController()]
return viewControllers
}
//MARK: - Actions
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment