Commit ab7ddf72 by Daniel Dahan

cleanup for TabBar that utilizzes Bar::centerViews

parent 59bd53e2
...@@ -71,15 +71,12 @@ class ViewController: UIViewController { ...@@ -71,15 +71,12 @@ class ViewController: UIViewController {
} }
private func prepareBar() { private func prepareBar() {
bar = Bar() bar = Bar(leftViews: [menuButton], rightViews: [favoriteButton, shareButton])
bar.backgroundColor = Color.blue.base bar.backgroundColor = Color.blue.base
bar.contentView.cornerRadiusPreset = .cornerRadius1 bar.contentView.cornerRadiusPreset = .cornerRadius1
bar.contentView.backgroundColor = Color.blue.lighten3 bar.contentView.backgroundColor = Color.blue.lighten3
bar.leftViews = [menuButton]
bar.rightViews = [favoriteButton, shareButton]
view.layout(bar).horizontally().center() view.layout(bar).horizontally().center()
} }
} }
......
...@@ -241,9 +241,9 @@ open class Bar: View { ...@@ -241,9 +241,9 @@ open class Bar: View {
*/ */
open override func prepare() { open override func prepare() {
super.prepare() super.prepare()
autoresizingMask = .flexibleWidth
interimSpacePreset = .interimSpace3 interimSpacePreset = .interimSpace3
contentEdgeInsetsPreset = .square1 contentEdgeInsetsPreset = .square1
prepareContentView() prepareContentView()
} }
......
...@@ -78,7 +78,7 @@ open class TabBar: Bar { ...@@ -78,7 +78,7 @@ open class TabBar: Bar {
b.removeFromSuperview() b.removeFromSuperview()
} }
contentView.grid.views = buttons as [UIView] centerViews = buttons as [UIView]
layoutSubviews() layoutSubviews()
} }
...@@ -137,11 +137,10 @@ open class TabBar: Bar { ...@@ -137,11 +137,10 @@ open class TabBar: Bar {
return return
} }
let columns: Int = contentView.grid.axis.columns / buttons.count
for b in buttons { for b in buttons {
b.grid.columns = columns b.grid.columns = 0
b.contentEdgeInsets = .zero
b.cornerRadius = 0 b.cornerRadius = 0
b.contentEdgeInsets = .zero
if isLineAnimated { if isLineAnimated {
prepareLineAnimationHandler(button: b) prepareLineAnimationHandler(button: b)
...@@ -210,7 +209,6 @@ open class TabBar: Bar { ...@@ -210,7 +209,6 @@ open class TabBar: Bar {
super.prepare() super.prepare()
contentEdgeInsetsPreset = .none contentEdgeInsetsPreset = .none
interimSpacePreset = .none interimSpacePreset = .none
autoresizingMask = .flexibleWidth
prepareLine() prepareLine()
prepareDivider() prepareDivider()
} }
......
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