Commit 483f7225 by Daniel Dahan

development: fixed ordering with NavigationBar when backButton is present

parent 78163a30
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Material' s.name = 'Material'
s.version = '2.3.12' s.version = '2.3.13'
s.license = 'BSD-3-Clause' s.license = 'BSD-3-Clause'
s.summary = 'Material is an animation and graphics framework that is used to create beautiful applications.' s.summary = 'Material is an animation and graphics framework that is used to create 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.3.12</string> <string>2.3.13</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -39,7 +39,7 @@ public enum GridAxisDirection: Int { ...@@ -39,7 +39,7 @@ public enum GridAxisDirection: Int {
public struct GridAxis { public struct GridAxis {
/// The direction the grid lays its views out. /// The direction the grid lays its views out.
var direction = GridAxisDirection.horizontal public var direction = GridAxisDirection.horizontal
/// The rows size. /// The rows size.
public var rows: Int public var rows: Int
...@@ -77,12 +77,12 @@ public struct GridOffset { ...@@ -77,12 +77,12 @@ public struct GridOffset {
} }
public struct Grid { public struct Grid {
/// Defer the calculation.
public var deferred = false
/// Context view. /// Context view.
internal weak var context: UIView? internal weak var context: UIView?
/// Defer the calculation.
public var deferred = false
/// Number of rows. /// Number of rows.
public var rows: Int { public var rows: Int {
didSet { didSet {
...@@ -197,6 +197,13 @@ public struct Grid { ...@@ -197,6 +197,13 @@ public struct Grid {
return return
} }
for v in views {
if canvas != v.superview {
v.removeFromSuperview()
canvas.addSubview(v)
}
}
guard 0 < canvas.width && 0 < canvas.height else { guard 0 < canvas.width && 0 < canvas.height else {
return return
} }
...@@ -211,11 +218,6 @@ public struct Grid { ...@@ -211,11 +218,6 @@ public struct Grid {
var i = 0 var i = 0
for v in views { for v in views {
if canvas != v.superview {
v.removeFromSuperview()
canvas.addSubview(v)
}
// Forces the view to adjust accordingly to size changes, ie: UILabel. // Forces the view to adjust accordingly to size changes, ie: UILabel.
(v as? UILabel)?.sizeToFit() (v as? UILabel)?.sizeToFit()
......
...@@ -141,7 +141,7 @@ extension NavigationController: UINavigationBarDelegate { ...@@ -141,7 +141,7 @@ extension NavigationController: UINavigationBarDelegate {
if let v = navigationBar as? NavigationBar { if let v = navigationBar as? NavigationBar {
item.backButton.addTarget(self, action: #selector(handleBackButton), for: .touchUpInside) item.backButton.addTarget(self, action: #selector(handleBackButton), for: .touchUpInside)
item.backButton.image = v.backButtonImage item.backButton.image = v.backButtonImage
item.leftViews.append(item.backButton) item.leftViews.insert(item.backButton, at: 0)
v.layoutNavigationItem(item: item) v.layoutNavigationItem(item: item)
} }
return true return true
......
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