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 {
@objc(TabBarStyle)
public enum TabBarStyle: Int {
case normal
case scrollable
// case scrollable
}
open class TabBar: Bar {
......@@ -78,7 +78,7 @@ open class TabBar: Bar {
}
/// An enum that determines the tab bar style.
open var tabBarStyle = TabBarStyle.scrollable {
open var tabBarStyle = TabBarStyle.normal {
didSet {
layoutSubviews()
}
......@@ -270,32 +270,32 @@ open class TabBar: Bar {
layoutDivider()
let buttonsWidth = buttons.reduce(0) {
$0 + $1.sizeThatFits(CGSize(width: .greatestFiniteMagnitude, height: contentView.height)).width + interimSpace
}
// let buttonsWidth = buttons.reduce(0) {
// $0 + $1.sizeThatFits(CGSize(width: .greatestFiniteMagnitude, height: contentView.height)).width + interimSpace
// }
if .scrollable == tabBarStyle && buttonsWidth > p {
scrollView.frame = CGRect(x: l, y: 0, width: p, height: height)
var w: CGFloat = 0
for b in buttons {
let width = b.sizeThatFits(CGSize(width: CGFloat.greatestFiniteMagnitude, height: contentView.height)).width + interimSpace
scrollView.addSubview(b)
b.height = scrollView.height
b.width = width
b.x = w
w += width
}
scrollView.contentSize = CGSize(width: buttonsWidth, height: height)
scrollView.addSubview(line)
} else {
// if .scrollable == tabBarStyle && buttonsWidth > p {
// scrollView.frame = CGRect(x: l, y: 0, width: p, height: height)
//
// var w: CGFloat = 0
//
// for b in buttons {
// let width = b.sizeThatFits(CGSize(width: CGFloat.greatestFiniteMagnitude, height: contentView.height)).width + interimSpace
// scrollView.addSubview(b)
// b.height = scrollView.height
// b.width = width
// b.x = w
// w += width
// }
//
// scrollView.contentSize = CGSize(width: buttonsWidth, height: height)
// scrollView.addSubview(line)
// } else {
contentView.grid.axis.columns = buttons.count
centerViews = buttons
addSubview(line)
}
// }
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