The selected tab indicator in the XLPagerTabStrip Library is not working with Swift 3 and XCode 8
I'm using the following customization for the Tab Strip
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
答案 0 :(得分:1)
This is the solution for the above mentioned issue
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()
}
}