Commit 7720770c by Daniel Dahan

development: removed scrollable feature from TabBar until the feature is ready

parent ae52f778
...@@ -60,7 +60,7 @@ public protocol TabBarDelegate { ...@@ -60,7 +60,7 @@ public protocol TabBarDelegate {
@objc(TabBarStyle) @objc(TabBarStyle)
public enum TabBarStyle: Int { public enum TabBarStyle: Int {
case normal case normal
case scrollable // case scrollable
} }
open class TabBar: Bar { open class TabBar: Bar {
...@@ -78,7 +78,7 @@ open class TabBar: Bar { ...@@ -78,7 +78,7 @@ open class TabBar: Bar {
} }
/// An enum that determines the tab bar style. /// An enum that determines the tab bar style.
open var tabBarStyle = TabBarStyle.scrollable { open var tabBarStyle = TabBarStyle.normal {
didSet { didSet {
layoutSubviews() layoutSubviews()
} }
...@@ -270,32 +270,32 @@ open class TabBar: Bar { ...@@ -270,32 +270,32 @@ open class TabBar: Bar {
layoutDivider() layoutDivider()
let buttonsWidth = buttons.reduce(0) { // let buttonsWidth = buttons.reduce(0) {
$0 + $1.sizeThatFits(CGSize(width: .greatestFiniteMagnitude, height: contentView.height)).width + interimSpace // $0 + $1.sizeThatFits(CGSize(width: .greatestFiniteMagnitude, height: contentView.height)).width + interimSpace
} // }
if .scrollable == tabBarStyle && buttonsWidth > p { // if .scrollable == tabBarStyle && buttonsWidth > p {
scrollView.frame = CGRect(x: l, y: 0, width: p, height: height) // scrollView.frame = CGRect(x: l, y: 0, width: p, height: height)
//
var w: CGFloat = 0 // var w: CGFloat = 0
//
for b in buttons { // for b in buttons {
let width = b.sizeThatFits(CGSize(width: CGFloat.greatestFiniteMagnitude, height: contentView.height)).width + interimSpace // let width = b.sizeThatFits(CGSize(width: CGFloat.greatestFiniteMagnitude, height: contentView.height)).width + interimSpace
scrollView.addSubview(b) // scrollView.addSubview(b)
b.height = scrollView.height // b.height = scrollView.height
b.width = width // b.width = width
b.x = w // b.x = w
w += width // w += width
} // }
//
scrollView.contentSize = CGSize(width: buttonsWidth, height: height) // scrollView.contentSize = CGSize(width: buttonsWidth, height: height)
scrollView.addSubview(line) // scrollView.addSubview(line)
} else { // } else {
contentView.grid.axis.columns = buttons.count contentView.grid.axis.columns = buttons.count
centerViews = buttons centerViews = buttons
addSubview(line) addSubview(line)
} // }
updateSelectionLine() updateSelectionLine()
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment