Commit cebb68d0 by Daniel Dahan

fixed rotational statusBar issue with SideNavigationController

parent 75472447
...@@ -614,7 +614,6 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -614,7 +614,6 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
public func closeLeftView(velocity: CGFloat = 0) { public func closeLeftView(velocity: CGFloat = 0) {
if enabledLeftView { if enabledLeftView {
if let v: MaterialView = leftView { if let v: MaterialView = leftView {
showStatusBar()
userInteractionEnabled = true userInteractionEnabled = true
delegate?.sideNavigationWillClose?(self, position: .Left) delegate?.sideNavigationWillClose?(self, position: .Left)
UIView.animateWithDuration(Double(0 == velocity ? animationDuration : fmax(0.1, fmin(1, Double(v.x / velocity)))), UIView.animateWithDuration(Double(0 == velocity ? animationDuration : fmax(0.1, fmin(1, Double(v.x / velocity)))),
...@@ -623,6 +622,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -623,6 +622,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
self.rootViewController.view.alpha = 1 self.rootViewController.view.alpha = 1
}) { [unowned self] _ in }) { [unowned self] _ in
self.hideView(v) self.hideView(v)
self.toggleStatusBar()
self.delegate?.sideNavigationDidClose?(self, position: .Left) self.delegate?.sideNavigationDidClose?(self, position: .Left)
} }
} }
...@@ -647,6 +647,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -647,6 +647,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
self.rootViewController.view.alpha = 1 self.rootViewController.view.alpha = 1
}) { [unowned self] _ in }) { [unowned self] _ in
self.hideView(v) self.hideView(v)
self.toggleStatusBar()
self.delegate?.sideNavigationDidClose?(self, position: .Right) self.delegate?.sideNavigationDidClose?(self, position: .Right)
} }
} }
...@@ -960,28 +961,24 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -960,28 +961,24 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
/// Shows the statusBar. /// Shows the statusBar.
private func showStatusBar() { private func showStatusBar() {
willHideStatusBar = false willHideStatusBar = false
if MaterialDevice.statusBarHidden { UIView.animateWithDuration(NSTimeInterval(UINavigationControllerHideShowBarDuration),
UIView.animateWithDuration(NSTimeInterval(UINavigationControllerHideShowBarDuration), animations: { [weak self] in
animations: { [weak self] in self?.setNeedsStatusBarAppearanceUpdate()
self?.setNeedsStatusBarAppearanceUpdate() MaterialDevice.statusBarHidden = false
MaterialDevice.statusBarHidden = false })
}) delegate?.sideNavigationStatusBarHiddenState?(self, hidden: false)
delegate?.sideNavigationStatusBarHiddenState?(self, hidden: false)
}
} }
/// Hides the statusBar. /// Hides the statusBar.
private func hideStatusBar() { private func hideStatusBar() {
if enableHideStatusbar { if enableHideStatusbar {
if !MaterialDevice.statusBarHidden { willHideStatusBar = true
willHideStatusBar = true UIView.animateWithDuration(NSTimeInterval(UINavigationControllerHideShowBarDuration),
UIView.animateWithDuration(NSTimeInterval(UINavigationControllerHideShowBarDuration), animations: { [weak self] in
animations: { [weak self] in self?.setNeedsStatusBarAppearanceUpdate()
self?.setNeedsStatusBarAppearanceUpdate() MaterialDevice.statusBarHidden = true
MaterialDevice.statusBarHidden = true })
}) delegate?.sideNavigationStatusBarHiddenState?(self, hidden: true)
delegate?.sideNavigationStatusBarHiddenState?(self, hidden: 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