Commit ab7ddf72 by Daniel Dahan

cleanup for TabBar that utilizzes Bar::centerViews

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