0

I'm using XLPagerTabStrip in a swift 4 application, I use collectionview and everything works fine but button bar is hidden behind the navigation bar.

i searched about this issue.so i got this link and answer

XLPagerTabStrip ButtonBar sticks behind Navigation Bar

and i edit this. i set collectionview class to "ButtonBarView". link of image is this

image link : https://i.stack.imgur.com/WjARH.png

Then connect its outlet with view in left panel

image link : https://i.stack.imgur.com/uyFBr.png

but it did not work for me. i searched another website and issue.

link : https://github.com/xmartlabs/XLPagerTabStrip/issues/262

and i edit my code with this. after

 ViewDidLoad

add below code

self.view.layoutIfNeeded()
buttonBarView.selectedBar.frame.origin.y = buttonBarView.frame.size.height - settings.style.selectedBarHeight

but it did not work. my code is

class medicationViewController: ButtonBarPagerTabStripViewController {

override func viewDidLoad() {
self.loaDesign()
super.viewDidLoad()
self.view.layoutIfNeeded()
buttonBarView.selectedBar.frame.origin.y = buttonBarView.frame.size.height - settings.style.selectedBarHeight
    }

override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {

    let child_1 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "apercuViewController")
    let child_2 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "nouveauViewController")
    let child_3 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "prescripViewController")
    let child_4 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "schemaViewController")

    return [child_1,child_2,child_3,child_4]

}

 func loaDesign() {
    // change selected bar color

    self.settings.style.selectedBarHeight = 2.0
    self.settings.style.selectedBarBackgroundColor =  UIColor(red: 0/255, green: 162/255, blue: 255/255, alpha: 1.0)
    self.settings.style.buttonBarBackgroundColor = UIColor.white
    self.settings.style.buttonBarItemBackgroundColor = UIColor.white
    self.settings.style.buttonBarItemFont = UIFont(name: "Poppins", size: 14)!
    self.settings.style.buttonBarItemTitleColor = .white

    self.settings.style.buttonBarMinimumLineSpacing = 0
    self.settings.style.buttonBarItemsShouldFillAvailiableWidth = true
    self.settings.style.buttonBarLeftContentInset = 0
    self.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.black
        newCell?.label.textColor =  UIColor(red: 0/255, green: 162/255, blue: 255/255, alpha: 1.0)
    }
}

and in child view controller my code is

 extension apercuViewController : IndicatorInfoProvider{

func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
    return IndicatorInfo(title: "APERCU")
   }
 }

i want to add images of all this but they cannot allow me. here taking container view is necessary under collection view? i didnot take container view.

kush3040
  • 43
  • 1
  • 1
  • 6
  • Hi Please refer this page for asking good question which usually get upvoted,which helps in getting good answer [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) – v8-E Oct 05 '18 at 12:22
  • i got solution from this link: https://medium.com/michaeladeyeri/how-to-implement-android-like-tab-layouts-in-ios-using-swift-3-578516c3aa9 – kush3040 Oct 09 '18 at 06:01

0 Answers0