Commit f7279fc6 by Daniel Dahan

development: fixed UILabel Grid resizing

parent b1f97f5c
......@@ -97,7 +97,6 @@ extension ViewController {
imageCard.bottomBar = Bar()
imageCard.bottomBarEdgeInsetsPreset = .wideRectangle2
imageCard.bottomBarEdgeInsets.top = 0
imageCard.bottomBar?.contentViewAlignment = .center
imageCard.bottomBar?.leftViews = [favoriteButton]
imageCard.bottomBar?.centerViews = [label]
......
......@@ -178,6 +178,11 @@ open class Bar: View {
return
}
reload()
}
/// Reloads the view.
open func reload() {
var lc = 0
var rc = 0
let l = (CGFloat(leftViews.count) * interimSpace)
......
......@@ -233,6 +233,9 @@ public class Grid {
canvas.addSubview(child)
}
// Forces the views to adjust accordingly to size changes, ie: UILabel.
(child as? UILabel)?.sizeToFit()
switch axis.direction {
case .horizontal:
let c = 0 == child.grid.columns ? axis.columns / count : child.grid.columns
......
......@@ -220,7 +220,6 @@ open class NavigationBar: UINavigationBar {
}
item.contentView.grid.begin()
item.contentView.grid.views = item.centerViews
if .center == item.contentViewAlignment {
if lc < rc {
......
......@@ -76,17 +76,11 @@ open class Snackbar: Bar {
return super.hitTest(point, with: event)
}
open override func layoutSubviews() {
super.layoutSubviews()
guard willLayout else {
return
}
reload()
}
/// Reloads the view.
open func reload() {
open override func reload() {
super.reload()
centerViews = [textLabel]
}
......
......@@ -100,17 +100,11 @@ open class Toolbar: Bar {
}
contentViewAlignment = .center == titleLabel.textAlignment ? .center : .any
}
open override func layoutSubviews() {
super.layoutSubviews()
guard willLayout else {
return
}
reload()
}
/// Reloads the view.
open func reload() {
open override func reload() {
super.reload()
if nil != title && "" != title {
if nil == titleLabel.superview {
contentView.addSubview(titleLabel)
......
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