Commit d52f210d by Daniel Dahan

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

parent c1d5dff6
......@@ -64,6 +64,14 @@ public class MaterialAssociatedObjectNavigationItem {
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.
private func prepareTitleLabel() {
titleLabel = UILabel()
......@@ -119,18 +127,14 @@ public extension UINavigationItem {
}
set(value) {
titleLabel.text = value
item.reloadNavigationBar()
}
}
/// Title Label.
public internal(set) var titleLabel: UILabel {
get {
public var titleLabel: UILabel {
return item.titleLabel
}
set(value) {
item.titleLabel = value
}
}
/// Detail text.
public var detail: String? {
......@@ -139,18 +143,14 @@ public extension UINavigationItem {
}
set(value) {
detailLabel.text = value
item.reloadNavigationBar()
}
}
/// Detail Label.
public internal(set) var detailLabel: UILabel {
get {
public var detailLabel: UILabel {
return item.detailLabel
}
set(value) {
item.detailLabel = value
}
}
/// Left side UIControls.
public var leftControls: Array<UIControl>? {
......
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