Commit d52f210d by Daniel Dahan

updated NavigationItem to reload the NavigationBar subviews when the title or detail values change

parent c1d5dff6
...@@ -63,6 +63,14 @@ public class MaterialAssociatedObjectNavigationItem { ...@@ -63,6 +63,14 @@ public class MaterialAssociatedObjectNavigationItem {
prepareTitleLabel() prepareTitleLabel()
prepareDetailLabel() prepareDetailLabel()
} }
/// Reloads the subviews for the NavigationBar.
internal func reloadNavigationBar() {
guard let navigationBar = contentView?.superview?.superview as? NavigationBar else {
return
}
navigationBar.layoutSubviews()
}
/// Prepares the titleLabel. /// Prepares the titleLabel.
private func prepareTitleLabel() { private func prepareTitleLabel() {
...@@ -119,17 +127,13 @@ public extension UINavigationItem { ...@@ -119,17 +127,13 @@ public extension UINavigationItem {
} }
set(value) { set(value) {
titleLabel.text = value titleLabel.text = value
item.reloadNavigationBar()
} }
} }
/// Title Label. /// Title Label.
public internal(set) var titleLabel: UILabel { public var titleLabel: UILabel {
get { return item.titleLabel
return item.titleLabel
}
set(value) {
item.titleLabel = value
}
} }
/// Detail text. /// Detail text.
...@@ -139,17 +143,13 @@ public extension UINavigationItem { ...@@ -139,17 +143,13 @@ public extension UINavigationItem {
} }
set(value) { set(value) {
detailLabel.text = value detailLabel.text = value
item.reloadNavigationBar()
} }
} }
/// Detail Label. /// Detail Label.
public internal(set) var detailLabel: UILabel { public var detailLabel: UILabel {
get { return item.detailLabel
return item.detailLabel
}
set(value) {
item.detailLabel = value
}
} }
/// Left side UIControls. /// Left side UIControls.
......
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