XLPagerTabStrip
XLPagerTabStrip copied to clipboard
Is there anyway to change selectedBar width?
Hi . Is there anyway to change selectedBar width? I want a shorter selectbar
You can add a custom selected bar like this:
let rect = CGRect(x: 0, y: 0, width: 16, height: 2)
let customSelectedBar = ShapeView(frame: rect)
customSelectedBar.shapeLayer.path = UIBezierPath(roundedRect: rect, cornerRadius: 2).cgPath
customSelectedBar.shapeLayer.fillColor = Color.primaryColor.cgColor
buttonBarView.selectedBar.addSubview(customSelectedBar)
customSelectedBar.snp.makeConstraints {
$0.size.equalTo(rect.size)
$0.centerX.bottom.equalToSuperview()
}
you can override "updateSelectedBarPosition" the function of ButtonBarView. Adjust the "selectedBarFrame.size.width = selectedCellFrame.size.width" and "selectedBarFrame.origin.x = selectedCellFrame.origin.x".
Have any progerss?