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
lib_addr: https://github.com/pujiaxin33/JXSegmentedView lib_version: 1.3.0,1.2.5 iOS 15.2 iPhone7
itemWidth,itemWidthIncrement 生效或定制化问题,UILabel标题漏出,导致覆盖
解决参考:
class MyCustomTabTitleDataSource: JXSegmentedTitleDataSource{ open override func registerCellClass(in segmentedView: JXSegmentedView) { segmentedView.collectionView.register(MyCustomTabTitleCell.self, forCellWithReuseIdentifier: "cell") } } class MyCustomTabTitleCell: JXSegmentedTitleCell { open override func layoutSubviews() { super.layoutSubviews() guard let myItemModel = itemModel as? JXSegmentedTitleItemModel else { return } let labelSize = titleLabel.sizeThatFits(self.contentView.bounds.size) var labelBounds = CGRect(x: 0, y: 0, width: labelSize.width, height: labelSize.height) // 增加以下一句,可限制UILabel 漏出或撑出UICollectionViewCell 问题 // dataSource 中的 widthForTitleClosure 或 open func widthForTitle(_ title: String) -> CGFloat 会生效 labelBounds.size.width = myItemModel.textWidth titleLabel.bounds = labelBounds titleLabel.center = contentView.center maskTitleLabel.bounds = labelBounds maskTitleLabel.center = contentView.center } }
参考代码:
let segmentView = JXSegmentedView() segmentView.delegate = self let dataSource = MyCustomTabTitleDataSource() dataSource.titles = ["很长很长的标题/很长很长的标题/很长很长的标题","不是很长的标题"] dataSource.widthForTitleClosure = {[weak self] ( aString) -> CGFloat in // print("aString:\(aString)") return (UIScreen.main.bounds / CGFloat(2)) } segmentView.dataSource = dataSource
The text was updated successfully, but these errors were encountered:
No branches or pull requests
lib_addr: https://github.com/pujiaxin33/JXSegmentedView
lib_version: 1.3.0,1.2.5
iOS 15.2 iPhone7
itemWidth,itemWidthIncrement 生效或定制化问题,UILabel标题漏出,导致覆盖
解决参考:
参考代码:
The text was updated successfully, but these errors were encountered: