Skip to content

Instantly share code, notes, and snippets.

@iAmrSalman
Created March 10, 2018 21:23
Show Gist options
  • Save iAmrSalman/b372446a6af1ca34287246ed98b45d59 to your computer and use it in GitHub Desktop.
Save iAmrSalman/b372446a6af1ca34287246ed98b45d59 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