XLPagerTabStrip

时间:2018-02-28 06:43:31

标签: ios iphone swift4 xlpagertabstrip

我正在尝试在我的应用程序中实现XLPagerTabStrip。一切都很好,因为我跟随官方Tutorial我已将collectionView的颜色更改为红色。当应用程序在模拟器中运行时,我看到有一个空白空间,如图像

我想知道如何删除该空白区域?因为它应该全是红色,如何更改黑线颜色?

这是我的代码:

override func viewDidLoad() {
    super.viewDidLoad()
    settings.style.buttonBarBackgroundColor = .red
    settings.style.buttonBarItemBackgroundColor = .red
    settings.style.selectedBarBackgroundColor = purpleInspireColor
    settings.style.buttonBarItemFont = UIFont.systemFont(ofSize: 12, weight: UIFont.Weight.regular)
    settings.style.selectedBarHeight = 0.5
    settings.style.buttonBarMinimumLineSpacing = 0
    settings.style.buttonBarItemTitleColor = .white
    settings.style.buttonBarItemsShouldFillAvailiableWidth = 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 = .white
        newCell?.label.textColor = self?.purpleInspireColor
    }
}

image of my app

1 个答案:

答案 0 :(得分:1)

我解决了我的问题我忘记了这行super.viewDidLoad()应该是viewDidload方法的最后一行