0

Am using XLPagerTabStrip library in my application.

https://github.com/xmartlabs/XLPagerTabStrip

Here how am using it:

  import UIKit
  import XLPagerTabStrip

class MyAccountViewController: ButtonBarPagerTabStripViewController {

override func viewDidLoad() {
    super.viewDidLoad()

    self.settings.style.buttonBarBackgroundColor = .white
    self.settings.style.buttonBarItemBackgroundColor = .white
    self.settings.style.selectedBarBackgroundColor = UIColor(red:0.52, green:0.77, blue:0.33, alpha:1.0)
    self.settings.style.buttonBarItemFont = .boldSystemFont(ofSize: 13)
    self.settings.style.selectedBarHeight = 2.0
    self.settings.style.buttonBarMinimumLineSpacing = 10
    self.settings.style.buttonBarItemTitleColor = .black
    self.settings.style.buttonBarItemsShouldFillAvailableWidth = true
    self.settings.style.buttonBarLeftContentInset = 0
    self.settings.style.buttonBarRightContentInset = 0
    self.settings.style.selectedBarHeight = 4.0

    changeCurrentIndexProgressive = { [weak self] (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in
        guard changeCurrentIndex == true else { return }
        oldCell?.label.textColor = UIColor.lightGray
        newCell?.label.textColor = .black

    }

   // navview.addBottomBorderWithColor(color: .lightGray, width: 0.5)
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
    let child1 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "jobinfo")
    let child2 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "jobedu")
    let child3 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "jobcv")
    return [child1,child2,child3]
}

} 

and storyboard:

enter image description here

but for some reason.. the scrollview take over all of the screen and everything is behind it even i have set its constraints!

This is what i got:

enter image description here

everything is behind the child view .. how to solve this?

mrs.bassim
  • 379
  • 1
  • 5
  • 14

1 Answers1

0

From their instruction. "Important: Settings should be called before viewDidLoad is called."

override func viewDidLoad() { 
    self.settings.style.selectedBarHeight = 2
    self.settings.style.selectedBarBackgroundColor = UIColor.white
    super.viewDidLoad()
}
macha
  • 1