NickCoder
NickCoder

Reputation: 1530

When pager loads for the first time view in first childViewController leaves space from both side for the first time

when XLPagerTabStrip loads view in the first child view controller leave space from both sides but if I switched tabs then it acquires the screen as I wanted.

here is the screenshot of a simulator for understanding:

enter image description here

And after switching tabs it shows full-width view[As expected]:

enter image description here

my whole setup is normal tableview has nothing done in that its just a view and here is XKPager setup

    settings.style.buttonBarBackgroundColor = appBlueColor
    settings.style.buttonBarItemBackgroundColor = appBlueColor

    settings.style.selectedBarBackgroundColor = appBrownColor

    settings.style.buttonBarItemFont = UIFont.appRegularFontWith(size: 16)

    settings.style.selectedBarHeight = 4.0
    settings.style.buttonBarMinimumLineSpacing = 0

    settings.style.buttonBarItemTitleColor = .black
    settings.style.buttonBarItemsShouldFillAvailableWidth = 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 = self?.oldCellColor
        oldCell?.label.font = UIFont.appRegularFontWith(size: 16)

        newCell?.label.textColor = .white
        newCell?.label.font = UIFont.appMediumFontWith(size: 16)
    }

   override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
    let child1 = UIStoryboard(name: "Home", bundle: nil).instantiateViewController(withIdentifier: "childViewController1")

    let child2 = UIStoryboard(name: "Home", bundle: nil).instantiateViewController(withIdentifier: "childViewController1")

    let child3 = UIStoryboard(name: "Home", bundle: nil).instantiateViewController(withIdentifier: "childViewController1")

    return [child1, child2, child3]
}

Xcode version: 11.2.1
swift version: 5
ios deployment target: 10.0
XLPager updated

Upvotes: 1

Views: 94

Answers (0)

Related Questions