XLPagerTabStrip库中的所选标签指示符不适用于Swift 3和XCode 8

我正在为标签栏使用以下自定义

    super.viewDidLoad()

    buttonBarView.selectedBar.backgroundColor = UIColor(red: 240.0/255.0, green: 89.0/255.0, blue: 43.0/255.0, alpha: 1.0)
    buttonBarView.backgroundColor = UIColor.clear

    settings.style.selectedBarHeight = 3.0
    settings.style.selectedBarBackgroundColor = UIColor(red: 240.0/255.0, green: 89.0/255.0, blue: 43.0/255.0, alpha: 1.0)

    settings.style.buttonBarHeight = 45.0
    settings.style.buttonBarMinimumLineSpacing = 0.0
    settings.style.buttonBarLeftContentInset = 0.0
    settings.style.buttonBarRightContentInset = 0.0
    settings.style.buttonBarItemFont = UIFont(name: "Avenir-Book", size: 12.0)!
    settings.style.buttonBarItemBackgroundColor = UIColor.clear
    settings.style.buttonBarItemLeftRightMargin = 0.0
    settings.style.buttonBarItemTitleColor = UIColor.black

最佳答案

这是上述问题的解决方案

    class ViewController: ButtonBarPagerTabStripViewController {

        override func viewDidAppear(_ animated: Bool) {
            let selectedBarHeight: CGFloat = 2

            buttonBarView.selectedBar.frame.origin.y = buttonBarView.frame.size.height - selectedBarHeight
            buttonBarView.selectedBar.frame.size.height = selectedBarHeight

        }


        override func viewDidLoad() {
            settings.style.selectedBarBackgroundColor = .green

            super.viewDidLoad()
        }
    }

关于ios - XLPagerTabStrip-所选选项卡选择不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40925207/

10-12 01:49