Commit a9bd393e by Daniel Dahan

prepare for release

parent e2322500
...@@ -100,6 +100,7 @@ class ViewController: UIViewController, TextFieldDelegate { ...@@ -100,6 +100,7 @@ class ViewController: UIViewController, TextFieldDelegate {
textField.detailLabel!.text = "Email is incorrect." textField.detailLabel!.text = "Email is incorrect."
textField.detailLabel!.font = RobotoFont.mediumWithSize(12) textField.detailLabel!.font = RobotoFont.mediumWithSize(12)
textField.detailLabelActiveColor = MaterialColor.red.accent3 textField.detailLabelActiveColor = MaterialColor.red.accent3
textField.detailLabelAutoHideEnabled = false // Comment out this line to have automatic hiding.
let image = UIImage(named: "ic_close_white")?.imageWithRenderingMode(.AlwaysTemplate) let image = UIImage(named: "ic_close_white")?.imageWithRenderingMode(.AlwaysTemplate)
......
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Material' s.name = 'Material'
s.version = '1.34.3' s.version = '1.34.4'
s.license = 'BSD' s.license = 'BSD'
s.summary = 'Express your creativity with Material, an animation and graphics framework for Google\'s Material Design and Apple\'s Flat UI in Swift.' s.summary = 'Express your creativity with Material, an animation and graphics framework for Google\'s Material Design and Apple\'s Flat UI in Swift.'
s.homepage = 'http://cosmicmind.io' s.homepage = 'http://cosmicmind.io'
......
...@@ -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>1.34.3</string> <string>1.34.4</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -48,6 +48,22 @@ public extension UIViewController { ...@@ -48,6 +48,22 @@ public extension UIViewController {
} }
} }
@objc(NavigationBarViewControllerDelegate)
public protocol NavigationBarViewControllerDelegate : MaterialDelegate {
/// Delegation method that executes when the floatingViewController will open.
optional func navigationBarViewControllerWillOpenFloatingViewController(navigationBarViewController: NavigationBarViewController)
/// Delegation method that executes when the floatingViewController will close.
optional func navigationBarViewControllerWillCloseFloatingViewController(navigationBarViewController: NavigationBarViewController)
/// Delegation method that executes when the floatingViewController did open.
optional func navigationBarViewControllerDidOpenFloatingViewController(navigationBarViewController: NavigationBarViewController)
/// Delegation method that executes when the floatingViewController did close.
optional func navigationBarViewControllerDidCloseFloatingViewController(navigationBarViewController: NavigationBarViewController)
}
@objc(NavigationBarViewController)
public class NavigationBarViewController: StatusBarViewController { public class NavigationBarViewController: StatusBarViewController {
/// Internal reference to the floatingViewController. /// Internal reference to the floatingViewController.
private var internalFloatingViewController: UIViewController? private var internalFloatingViewController: UIViewController?
...@@ -55,6 +71,9 @@ public class NavigationBarViewController: StatusBarViewController { ...@@ -55,6 +71,9 @@ public class NavigationBarViewController: StatusBarViewController {
/// Reference to the NavigationBarView. /// Reference to the NavigationBarView.
public private(set) lazy var navigationBarView: NavigationBarView = NavigationBarView() public private(set) lazy var navigationBarView: NavigationBarView = NavigationBarView()
/// Delegation handler.
public weak var delegate: NavigationBarViewControllerDelegate?
/// A floating UIViewController. /// A floating UIViewController.
public var floatingViewController: UIViewController? { public var floatingViewController: UIViewController? {
get { get {
...@@ -62,6 +81,7 @@ public class NavigationBarViewController: StatusBarViewController { ...@@ -62,6 +81,7 @@ public class NavigationBarViewController: StatusBarViewController {
} }
set(value) { set(value) {
if let v: UIViewController = internalFloatingViewController { if let v: UIViewController = internalFloatingViewController {
delegate?.navigationBarViewControllerWillCloseFloatingViewController?(self)
internalFloatingViewController = nil internalFloatingViewController = nil
UIView.animateWithDuration(0.5, UIView.animateWithDuration(0.5,
animations: { [unowned self] in animations: { [unowned self] in
...@@ -74,6 +94,9 @@ public class NavigationBarViewController: StatusBarViewController { ...@@ -74,6 +94,9 @@ public class NavigationBarViewController: StatusBarViewController {
v.removeFromParentViewController() v.removeFromParentViewController()
self.userInteractionEnabled = true self.userInteractionEnabled = true
self.navigationBarView.userInteractionEnabled = true self.navigationBarView.userInteractionEnabled = true
dispatch_async(dispatch_get_main_queue()) { [unowned self] in
self.delegate?.navigationBarViewControllerDidCloseFloatingViewController?(self)
}
} }
} }
...@@ -92,12 +115,17 @@ public class NavigationBarViewController: StatusBarViewController { ...@@ -92,12 +115,17 @@ public class NavigationBarViewController: StatusBarViewController {
internalFloatingViewController = v internalFloatingViewController = v
userInteractionEnabled = false userInteractionEnabled = false
navigationBarView.userInteractionEnabled = false navigationBarView.userInteractionEnabled = false
delegate?.navigationBarViewControllerWillOpenFloatingViewController?(self)
UIView.animateWithDuration(0.5, UIView.animateWithDuration(0.5,
animations: { [unowned self] in animations: { [unowned self] in
v.view.center.y = self.view.bounds.height / 2 v.view.center.y = self.view.bounds.height / 2
self.navigationBarView.alpha = 0.5 self.navigationBarView.alpha = 0.5
self.mainViewController.view.alpha = 0.5 self.mainViewController.view.alpha = 0.5
}) }) { [unowned self] _ in
dispatch_async(dispatch_get_main_queue()) { [unowned self] in
self.delegate?.navigationBarViewControllerDidOpenFloatingViewController?(self)
}
}
} }
} }
} }
......
...@@ -338,6 +338,12 @@ public class TextField : UITextField { ...@@ -338,6 +338,12 @@ public class TextField : UITextField {
public var detailLabelAnimationDistance: CGFloat = 8 public var detailLabelAnimationDistance: CGFloat = 8
/** /**
A Boolean that indicates the detailLabel should hide
automatically when text changes.
*/
public var detailLabelAutoHideEnabled: Bool = true
/**
:name: detailLabelHidden :name: detailLabelHidden
*/ */
public var detailLabelHidden: Bool = true { public var detailLabelHidden: Bool = true {
...@@ -489,7 +495,7 @@ public class TextField : UITextField { ...@@ -489,7 +495,7 @@ public class TextField : UITextField {
/// Ahdnler when text value changed. /// Ahdnler when text value changed.
internal func textFieldValueChanged() { internal func textFieldValueChanged() {
if !detailLabelHidden { if detailLabelAutoHideEnabled && !detailLabelHidden {
detailLabelHidden = true detailLabelHidden = true
MaterialAnimation.animationDisabled { [unowned self] in MaterialAnimation.animationDisabled { [unowned self] in
self.bottomBorderLayer.backgroundColor = self.titleLabelActiveColor?.CGColor self.bottomBorderLayer.backgroundColor = self.titleLabelActiveColor?.CGColor
......
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