Commit 6f9098e6 by Daniel Dahan

issue-907: Fixed layout ordering issues

parent 8e91d135
## 2.12.3
* [issue-907](https://github.com/CosmicMind/Material/issues/907): Fixed Layout ordering issues.
## 2.12.2 ## 2.12.2
* [issue-860](https://github.com/CosmicMind/Material/issues/860): Updated TabBar color states and added an independent line color state. * [issue-860](https://github.com/CosmicMind/Material/issues/860): Updated TabBar color states and added an independent line color state.
......
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Material' s.name = 'Material'
s.version = '2.12.2' s.version = '2.12.3'
s.license = 'BSD-3-Clause' s.license = 'BSD-3-Clause'
s.summary = 'A UI/UX framework for creating beautiful applications.' s.summary = 'A UI/UX framework for creating beautiful applications.'
s.homepage = 'http://materialswift.com' s.homepage = 'http://materialswift.com'
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>2.12.2</string> <string>2.12.3</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -631,14 +631,26 @@ public class Layout { ...@@ -631,14 +631,26 @@ public class Layout {
fileprivate extension Layout { fileprivate extension Layout {
/** /**
Updates and lays out the constraints for a given view. Updates the consraints for a given view.
- Parameter for view: A UIView. - Parameter for view: A UIView.
*/ */
class func updateConstraints(for view: UIView) { class func updateConstraints(for view: UIView) {
view.updateConstraintsIfNeeded() DispatchQueue.main.async {
view.updateConstraints()
view.setNeedsLayout() view.setNeedsLayout()
view.layoutIfNeeded() view.layoutIfNeeded()
view.updateConstraintsIfNeeded()
view.updateConstraints()
}
}
/**
Updates the constraints for a given Array of views.
- Parameter for [view]: An Array of UIViews.
*/
class func updateConstraints(for views: [UIView]) {
for v in views {
updateConstraints(for: v)
}
} }
} }
...@@ -700,9 +712,7 @@ extension Layout { ...@@ -700,9 +712,7 @@ extension Layout {
parent.addConstraint(NSLayoutConstraint(item: children[children.count - 1], attribute: .right, relatedBy: .equal, toItem: parent, attribute: .right, multiplier: 1, constant: -right)) parent.addConstraint(NSLayoutConstraint(item: children[children.count - 1], attribute: .right, relatedBy: .equal, toItem: parent, attribute: .right, multiplier: 1, constant: -right))
} }
for child in children { updateConstraints(for: children)
updateConstraints(for: child)
}
} }
/** /**
...@@ -726,9 +736,7 @@ extension Layout { ...@@ -726,9 +736,7 @@ extension Layout {
parent.addConstraint(NSLayoutConstraint(item: children[children.count - 1], attribute: .bottom, relatedBy: .equal, toItem: parent, attribute: .bottom, multiplier: 1, constant: -bottom)) parent.addConstraint(NSLayoutConstraint(item: children[children.count - 1], attribute: .bottom, relatedBy: .equal, toItem: parent, attribute: .bottom, multiplier: 1, constant: -bottom))
} }
for child in children { updateConstraints(for: children)
updateConstraints(for: child)
}
} }
/** /**
......
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