Commit ebaf45a1 by Daniel Dahan Committed by GitHub

Merge branch 'pr-review' into scrollable-tabbar

parents b8799024 d12b0cb0
...@@ -282,7 +282,7 @@ open class TabBar: Bar { ...@@ -282,7 +282,7 @@ open class TabBar: Bar {
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 = contentView.height b.height = scrollView.height
b.width = width b.width = width
b.x = w b.x = w
w += width w += width
...@@ -310,6 +310,8 @@ open class TabBar: Bar { ...@@ -310,6 +310,8 @@ open class TabBar: Bar {
} }
} }
scrollView.frame = contentView.bounds
if nil == selected { if nil == selected {
selected = buttons.first selected = buttons.first
} }
...@@ -340,6 +342,7 @@ extension TabBar { ...@@ -340,6 +342,7 @@ extension TabBar {
line.zPosition = 6000 line.zPosition = 6000
lineColor = Color.blue.base lineColor = Color.blue.base
lineHeight = 3 lineHeight = 3
scrollView.addSubview(line)
} }
/// Prepares the divider. /// Prepares the divider.
......
...@@ -375,8 +375,7 @@ extension TabsController { ...@@ -375,8 +375,7 @@ extension TabsController {
return return
} }
let p = v.height let y = view.height - v.height
let y = view.height - p
v.width = view.width v.width = view.width
...@@ -469,6 +468,9 @@ extension TabsController { ...@@ -469,6 +468,9 @@ extension TabsController {
guard i != selectedIndex else { guard i != selectedIndex else {
return return
} }
// removeViewControllers()
// prepareViewControllersForTransition(from: selectedIndex, to: i)
selectedIndex = i selectedIndex = i
v.select(at: i) v.select(at: i)
...@@ -490,7 +492,7 @@ extension TabsController: UIScrollViewDelegate { ...@@ -490,7 +492,7 @@ extension TabsController: UIScrollViewDelegate {
removeViewControllers() removeViewControllers()
prepareViewControllers() prepareViewControllers()
prepareTabBar() // prepareTabBar()
layoutSubviews() layoutSubviews()
} }
} }
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