updated tabs for logic on numberoflines
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
d3c3840ab3
commit
1986eceae2
@ -144,6 +144,10 @@ open class Tabs: View {
|
||||
orientation == .horizontal && fillContainer ? .center : .left
|
||||
}
|
||||
|
||||
private var applyOverflow: Bool {
|
||||
orientation == .horizontal && overflow == .scroll && !fillContainer
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
//--------------------------------------------------
|
||||
@ -258,7 +262,9 @@ open class Tabs: View {
|
||||
|
||||
/// Updates the Tab individual views from local properties.
|
||||
private func updateTabs() {
|
||||
let numberOfLines = applyOverflow ? 1 : 0
|
||||
for (index, tabItem) in tabViews.enumerated() {
|
||||
tabItem.label.numberOfLines = numberOfLines
|
||||
tabItem.size = size
|
||||
tabItem.isSelected = selectedIndex == index
|
||||
tabItem.index = index
|
||||
@ -277,10 +283,10 @@ open class Tabs: View {
|
||||
contentViewWidthConstraint?.isActive = false
|
||||
|
||||
// Apply overflow
|
||||
if orientation == .horizontal && overflow == .scroll && !fillContainer {
|
||||
let contentWidth = tabStackView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).width
|
||||
if applyOverflow {
|
||||
contentViewWidthConstraint = nil
|
||||
scrollView.contentSize = CGSize(width: contentWidth, height: scrollView.bounds.height)
|
||||
scrollView.contentSize = CGSize(width: tabStackView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).width,
|
||||
height: scrollView.bounds.height)
|
||||
} else {
|
||||
contentViewWidthConstraint = contentView.widthAnchor.constraint(equalTo: scrollView.widthAnchor)
|
||||
scrollView.contentSize = bounds.size
|
||||
@ -294,6 +300,11 @@ open class Tabs: View {
|
||||
scrollToSelectedIndex(animated: true)
|
||||
}
|
||||
|
||||
open override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
updateContentView()
|
||||
}
|
||||
|
||||
//update layout for borderline
|
||||
private func updateBorderline() {
|
||||
//borderLine
|
||||
|
||||
Loading…
Reference in New Issue
Block a user