Commit 9e666dce by Daniel Dahan

development: updated NavigationItem to allow contentViewAlignment to be set dynamically

parent 5462110c
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Material' s.name = 'Material'
s.version = '2.3.16' s.version = '2.3.17'
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.16</string> <string>2.3.17</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -32,7 +32,7 @@ import UIKit ...@@ -32,7 +32,7 @@ import UIKit
@objc(ContentViewAlignment) @objc(ContentViewAlignment)
public enum ContentViewAlignment: Int { public enum ContentViewAlignment: Int {
case any case full
case center case center
} }
...@@ -47,7 +47,7 @@ open class Bar: View { ...@@ -47,7 +47,7 @@ open class Bar: View {
} }
/// Should center the contentView. /// Should center the contentView.
open var contentViewAlignment = ContentViewAlignment.any { open var contentViewAlignment = ContentViewAlignment.full {
didSet { didSet {
layoutSubviews() layoutSubviews()
} }
......
...@@ -93,7 +93,7 @@ public class NavigationItem: NSObject { ...@@ -93,7 +93,7 @@ public class NavigationItem: NSObject {
super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context) super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
return return
} }
contentViewAlignment = .center == titleLabel.textAlignment ? .center : .any contentViewAlignment = .center == titleLabel.textAlignment ? .center : .full
} }
deinit { deinit {
...@@ -145,8 +145,13 @@ extension UINavigationItem { ...@@ -145,8 +145,13 @@ extension UINavigationItem {
/// Should center the contentView. /// Should center the contentView.
public var contentViewAlignment: ContentViewAlignment { public var contentViewAlignment: ContentViewAlignment {
get {
return navigationItem.contentViewAlignment return navigationItem.contentViewAlignment
} }
set(value) {
navigationItem.contentViewAlignment = value
}
}
/// Content View. /// Content View.
public var contentView: UIView { public var contentView: UIView {
......
...@@ -88,7 +88,7 @@ open class Toolbar: Bar { ...@@ -88,7 +88,7 @@ open class Toolbar: Bar {
super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context) super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
return return
} }
contentViewAlignment = .center == titleLabel.textAlignment ? .center : .any contentViewAlignment = .center == titleLabel.textAlignment ? .center : .full
} }
/// Reloads the view. /// Reloads the view.
......
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