Commit d12b0cb0 by Daniel Dahan

development: updated frame calculation for TabBar scroll view

parent 50a60baf
......@@ -215,8 +215,8 @@ open class TabBar: Bar {
for b in buttons {
let width = b.sizeThatFits(CGSize(width: CGFloat.greatestFiniteMagnitude, height: contentView.height)).width + interimSpace
contentView.addSubview(b)
b.height = contentView.height
scrollView.addSubview(b)
b.height = scrollView.height
b.width = width
b.x = w
w += width
......@@ -230,10 +230,12 @@ open class TabBar: Bar {
centerViews = buttons
}
scrollView.frame = contentView.bounds
if nil == selected {
selected = buttons.first
}
line.frame = CGRect(x: selected!.x, y: .bottom == lineAlignment ? height - lineHeight : 0, width: selected!.width, height: lineHeight)
}
......@@ -260,7 +262,7 @@ extension TabBar {
line.zPosition = 6000
lineColor = Color.blue.base
lineHeight = 3
addSubview(line)
scrollView.addSubview(line)
}
/// Prepares the divider.
......
......@@ -375,8 +375,7 @@ extension TabsController {
return
}
let p = v.height
let y = view.height - p
let y = view.height - v.height
v.width = view.width
......@@ -472,7 +471,7 @@ extension TabsController {
removeViewControllers()
prepareViewControllersForTransition(from: selectedIndex, to: i)
// prepareViewControllersForTransition(from: selectedIndex, to: i)
selectedIndex = i
v.select(at: i)
......@@ -492,7 +491,7 @@ extension TabsController: UIScrollViewDelegate {
removeViewControllers()
prepareViewControllers()
prepareTabBar()
// prepareTabBar()
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