We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
代码供参考: 方法1: @objc private func titleLabelClick(_ tapGes : UITapGestureRecognizer)中: if style.isShowBottomLine { UIView.animate(withDuration: 0.25, animations: { let bottomLineWidth = targetLabel.attributedText?.size().width ?? 0 let x = targetLabel.frame.origin.x + (targetLabel.frame.width - bottomLineWidth) / 2 self.bottomLine.frame.origin.x = x //targetLabel.frame.origin.x self.bottomLine.frame.size.width = bottomLineWidth //targetLabel.frame.width }) } 方法2: private func setupBottomLineLayout() { guard titleLabels.count - 1 >= currentIndex else { return } let label = titleLabels[currentIndex]
let bottomLineWidth = label.attributedText?.size().width ?? 0 let x = label.frame.origin.x + (label.frame.width - bottomLineWidth) / 2 bottomLine.frame.origin.x = x //label.frame.origin.x bottomLine.frame.origin.y = self.bounds.height - self.style.bottomLineHeight bottomLine.frame.size.width = bottomLineWidth//label.frame.width bottomLine.frame.size.height = self.style.bottomLineHeight }
The text was updated successfully, but these errors were encountered:
谢谢你的建议。 当style.isTitleViewScrollEnabled = true的时候,表示标签会比较多,所以默认会滑动,而且这时候会用到titleMargin这个属性,下划线宽度跟随文字宽度。 当style.isTitleViewScrollEnabled = fasle的时候,表示标签少,默认是每个标签的宽度平分titleView的宽度,下划线宽度跟随标签宽度,这种样式也是比较多人需要的。
style.isTitleViewScrollEnabled = true
titleMargin
style.isTitleViewScrollEnabled = fasle
titleView
你所说的情况,如果标签多,可以直接用style.isTitleViewScrollEnabled = true,如果标签少,除了设置style.isTitleViewScrollEnabled = true,还需要自己算titleView的宽度,具体代码可以参考demo的第四种样式
Sorry, something went wrong.
No branches or pull requests
代码供参考:
方法1:
@objc private func titleLabelClick(_ tapGes : UITapGestureRecognizer)中:
if style.isShowBottomLine {
UIView.animate(withDuration: 0.25, animations: {
let bottomLineWidth = targetLabel.attributedText?.size().width ?? 0
let x = targetLabel.frame.origin.x + (targetLabel.frame.width - bottomLineWidth) / 2
self.bottomLine.frame.origin.x = x //targetLabel.frame.origin.x
self.bottomLine.frame.size.width = bottomLineWidth //targetLabel.frame.width
})
}
方法2:
private func setupBottomLineLayout() {
guard titleLabels.count - 1 >= currentIndex else { return }
let label = titleLabels[currentIndex]
The text was updated successfully, but these errors were encountered: