Commit f4c2a71a by Daniel Dahan

added fix for StatusBar not hiding

parent ae33ab43
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
9663F94E1C7A74EA00AF0965 /* AppLeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */; }; 9663F94E1C7A74EA00AF0965 /* AppLeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */; };
9663F9521C7A751D00AF0965 /* ItemViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9511C7A751D00AF0965 /* ItemViewController.swift */; }; 9663F9521C7A751D00AF0965 /* ItemViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9511C7A751D00AF0965 /* ItemViewController.swift */; };
967A481B1D0F58F800B8CEB7 /* AppNavigationDrawerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967A481A1D0F58F800B8CEB7 /* AppNavigationDrawerController.swift */; }; 967A481B1D0F58F800B8CEB7 /* AppNavigationDrawerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967A481A1D0F58F800B8CEB7 /* AppNavigationDrawerController.swift */; };
967A481D1D0F5AFC00B8CEB7 /* AppStatusBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967A481C1D0F5AFC00B8CEB7 /* AppStatusBarController.swift */; };
96CC08881C7FEBD60034FF84 /* RecipesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */; }; 96CC08881C7FEBD60034FF84 /* RecipesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
...@@ -53,7 +52,6 @@ ...@@ -53,7 +52,6 @@
9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppLeftViewController.swift; sourceTree = "<group>"; }; 9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppLeftViewController.swift; sourceTree = "<group>"; };
9663F9511C7A751D00AF0965 /* ItemViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemViewController.swift; sourceTree = "<group>"; }; 9663F9511C7A751D00AF0965 /* ItemViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemViewController.swift; sourceTree = "<group>"; };
967A481A1D0F58F800B8CEB7 /* AppNavigationDrawerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppNavigationDrawerController.swift; sourceTree = "<group>"; }; 967A481A1D0F58F800B8CEB7 /* AppNavigationDrawerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppNavigationDrawerController.swift; sourceTree = "<group>"; };
967A481C1D0F5AFC00B8CEB7 /* AppStatusBarController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppStatusBarController.swift; sourceTree = "<group>"; };
96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecipesViewController.swift; sourceTree = "<group>"; }; 96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecipesViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
...@@ -88,7 +86,6 @@ ...@@ -88,7 +86,6 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9663F9311C7A744600AF0965 /* AppDelegate.swift */, 9663F9311C7A744600AF0965 /* AppDelegate.swift */,
967A481C1D0F5AFC00B8CEB7 /* AppStatusBarController.swift */,
9663F9471C7A749400AF0965 /* AppNavigationController.swift */, 9663F9471C7A749400AF0965 /* AppNavigationController.swift */,
967A481A1D0F58F800B8CEB7 /* AppNavigationDrawerController.swift */, 967A481A1D0F58F800B8CEB7 /* AppNavigationDrawerController.swift */,
960CDA481D09FF3E00387CE8 /* AppBottomNavigationController.swift */, 960CDA481D09FF3E00387CE8 /* AppBottomNavigationController.swift */,
...@@ -178,7 +175,6 @@ ...@@ -178,7 +175,6 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
967A481D1D0F5AFC00B8CEB7 /* AppStatusBarController.swift in Sources */,
967A481B1D0F58F800B8CEB7 /* AppNavigationDrawerController.swift in Sources */, 967A481B1D0F58F800B8CEB7 /* AppNavigationDrawerController.swift in Sources */,
9663F94A1C7A74B500AF0965 /* AppSearchBarViewController.swift in Sources */, 9663F94A1C7A74B500AF0965 /* AppSearchBarViewController.swift in Sources */,
96CC08881C7FEBD60034FF84 /* RecipesViewController.swift in Sources */, 96CC08881C7FEBD60034FF84 /* RecipesViewController.swift in Sources */,
......
...@@ -39,11 +39,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -39,11 +39,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let bottomNavigationController: AppBottomNavigationController = AppBottomNavigationController() let bottomNavigationController: AppBottomNavigationController = AppBottomNavigationController()
let navigationController: AppNavigationController = AppNavigationController(rootViewController: bottomNavigationController) let navigationController: AppNavigationController = AppNavigationController(rootViewController: bottomNavigationController)
let navigationDrawerController: AppNavigationDrawerController = AppNavigationDrawerController(rootViewController: navigationController, leftViewController: AppLeftViewController()) let menuController: AppMenuController = AppMenuController(rootViewController: navigationController)
let statusBarController: AppStatusBarController = AppStatusBarController(rootViewController: navigationDrawerController) let navigationDrawerController: AppNavigationDrawerController = AppNavigationDrawerController(rootViewController: menuController, leftViewController: AppLeftViewController())
window = UIWindow(frame: UIScreen.mainScreen().bounds) window = UIWindow(frame: UIScreen.mainScreen().bounds)
window!.rootViewController = statusBarController window!.rootViewController = navigationDrawerController
window!.makeKeyAndVisible() window!.makeKeyAndVisible()
return true return true
} }
......
...@@ -38,32 +38,38 @@ class AppNavigationDrawerController: NavigationDrawerController, NavigationDrawe ...@@ -38,32 +38,38 @@ class AppNavigationDrawerController: NavigationDrawerController, NavigationDrawe
} }
func navigationDrawerPanDidBegin(navigationDrawerController: NavigationDrawerController, point: CGPoint, position: SideNavigationPosition) { func navigationDrawerPanDidBegin(navigationDrawerController: NavigationDrawerController, point: CGPoint, position: SideNavigationPosition) {
showStatusBarView() print("NavigationDrawerController - Pan Began");
} }
func navigationDrawerPanDidEnd(navigationDrawerController: NavigationDrawerController, point: CGPoint, position: SideNavigationPosition) { func navigationDrawerPanDidEnd(navigationDrawerController: NavigationDrawerController, point: CGPoint, position: SideNavigationPosition) {
hideStatusBarView() print("NavigationDrawerController - Pan Ended");
} }
func navigationDrawerWillOpen(navigationDrawerController: NavigationDrawerController, position: SideNavigationPosition) { func navigationDrawerWillOpen(navigationDrawerController: NavigationDrawerController, position: SideNavigationPosition) {
showStatusBarView() print("NavigationDrawerController - Will Open");
}
func navigationDrawerDidOpen(navigationDrawerController: NavigationDrawerController, position: SideNavigationPosition) {
print("NavigationDrawerController - DId Open");
} }
func navigationDrawerWillClose(navigationDrawerController: NavigationDrawerController, position: SideNavigationPosition) { func navigationDrawerWillClose(navigationDrawerController: NavigationDrawerController, position: SideNavigationPosition) {
hideStatusBarView() print("NavigationDrawerController - Will Close");
}
func navigationDrawerDidClose(navigationDrawerController: NavigationDrawerController, position: SideNavigationPosition) {
print("NavigationDrawerController - Did Close");
}
func navigationDrawerStatusBarHiddenState(navigationDrawerController: NavigationDrawerController, hidden: Bool) {
print("NavigationDrawerController - Status Bar Hidden: ", hidden ? "Yes" : "No");
} }
/// Shows the transparent statusBarView. func navigationDrawerDidTap(navigationDrawerController: NavigationDrawerController, point: CGPoint, position: SideNavigationPosition) {
private func showStatusBarView() { print("NavigationDrawerController - Did Tap");
UIView.animateWithDuration(0.25, animations: { [weak self] in
self?.statusBarController?.statusBarView.alpha = 1
})
} }
/// Hides the transparent statusBarView. func navigationDrawerPanDidChange(navigationDrawerController: NavigationDrawerController, point: CGPoint, position: SideNavigationPosition) {
private func hideStatusBarView() { // print("NavigationDrawerController - Did Change");
UIView.animateWithDuration(0.25, animations: { [weak self] in
self?.statusBarController?.statusBarView.alpha = 0
})
} }
} }
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of Material nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
import Material
class AppStatusBarController: StatusBarController {
override func prepareView() {
super.prepareView()
statusBarView.alpha = 0
}
}
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
967A48071D0E0EA300B8CEB7 /* AppRightViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967A48061D0E0EA300B8CEB7 /* AppRightViewController.swift */; }; 967A48071D0E0EA300B8CEB7 /* AppRightViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967A48061D0E0EA300B8CEB7 /* AppRightViewController.swift */; };
967A48221D0F601B00B8CEB7 /* AppNavigationDrawerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967A48211D0F601B00B8CEB7 /* AppNavigationDrawerController.swift */; }; 967A48221D0F601B00B8CEB7 /* AppNavigationDrawerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967A48211D0F601B00B8CEB7 /* AppNavigationDrawerController.swift */; };
967A48241D0F603200B8CEB7 /* AppStatusBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967A48231D0F603200B8CEB7 /* AppStatusBarController.swift */; };
96CB75011D0DFDBB0012D9F2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96CB75001D0DFDBB0012D9F2 /* AppDelegate.swift */; }; 96CB75011D0DFDBB0012D9F2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96CB75001D0DFDBB0012D9F2 /* AppDelegate.swift */; };
96CB75031D0DFDBB0012D9F2 /* AppLeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96CB75021D0DFDBB0012D9F2 /* AppLeftViewController.swift */; }; 96CB75031D0DFDBB0012D9F2 /* AppLeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96CB75021D0DFDBB0012D9F2 /* AppLeftViewController.swift */; };
96CB75081D0DFDBB0012D9F2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96CB75071D0DFDBB0012D9F2 /* Assets.xcassets */; }; 96CB75081D0DFDBB0012D9F2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96CB75071D0DFDBB0012D9F2 /* Assets.xcassets */; };
...@@ -37,7 +36,6 @@ ...@@ -37,7 +36,6 @@
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
967A48061D0E0EA300B8CEB7 /* AppRightViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppRightViewController.swift; sourceTree = "<group>"; }; 967A48061D0E0EA300B8CEB7 /* AppRightViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppRightViewController.swift; sourceTree = "<group>"; };
967A48211D0F601B00B8CEB7 /* AppNavigationDrawerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppNavigationDrawerController.swift; sourceTree = "<group>"; }; 967A48211D0F601B00B8CEB7 /* AppNavigationDrawerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppNavigationDrawerController.swift; sourceTree = "<group>"; };
967A48231D0F603200B8CEB7 /* AppStatusBarController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppStatusBarController.swift; sourceTree = "<group>"; };
96CB74FD1D0DFDBB0012D9F2 /* NavigationDrawerController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NavigationDrawerController.app; sourceTree = BUILT_PRODUCTS_DIR; }; 96CB74FD1D0DFDBB0012D9F2 /* NavigationDrawerController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NavigationDrawerController.app; sourceTree = BUILT_PRODUCTS_DIR; };
96CB75001D0DFDBB0012D9F2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 96CB75001D0DFDBB0012D9F2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
96CB75021D0DFDBB0012D9F2 /* AppLeftViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLeftViewController.swift; sourceTree = "<group>"; }; 96CB75021D0DFDBB0012D9F2 /* AppLeftViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLeftViewController.swift; sourceTree = "<group>"; };
...@@ -82,7 +80,6 @@ ...@@ -82,7 +80,6 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96CB75001D0DFDBB0012D9F2 /* AppDelegate.swift */, 96CB75001D0DFDBB0012D9F2 /* AppDelegate.swift */,
967A48231D0F603200B8CEB7 /* AppStatusBarController.swift */,
967A48211D0F601B00B8CEB7 /* AppNavigationDrawerController.swift */, 967A48211D0F601B00B8CEB7 /* AppNavigationDrawerController.swift */,
96CB75021D0DFDBB0012D9F2 /* AppLeftViewController.swift */, 96CB75021D0DFDBB0012D9F2 /* AppLeftViewController.swift */,
967A48061D0E0EA300B8CEB7 /* AppRightViewController.swift */, 967A48061D0E0EA300B8CEB7 /* AppRightViewController.swift */,
...@@ -174,7 +171,6 @@ ...@@ -174,7 +171,6 @@
96CB75131D0DFF6F0012D9F2 /* YellowViewController.swift in Sources */, 96CB75131D0DFF6F0012D9F2 /* YellowViewController.swift in Sources */,
96CB75191D0DFFAE0012D9F2 /* PurpleViewController.swift in Sources */, 96CB75191D0DFFAE0012D9F2 /* PurpleViewController.swift in Sources */,
96CB75151D0DFF840012D9F2 /* BlueViewController.swift in Sources */, 96CB75151D0DFF840012D9F2 /* BlueViewController.swift in Sources */,
967A48241D0F603200B8CEB7 /* AppStatusBarController.swift in Sources */,
96CB75011D0DFDBB0012D9F2 /* AppDelegate.swift in Sources */, 96CB75011D0DFDBB0012D9F2 /* AppDelegate.swift in Sources */,
967A48071D0E0EA300B8CEB7 /* AppRightViewController.swift in Sources */, 967A48071D0E0EA300B8CEB7 /* AppRightViewController.swift in Sources */,
96CB751B1D0DFFC10012D9F2 /* OrangeViewController.swift in Sources */, 96CB751B1D0DFFC10012D9F2 /* OrangeViewController.swift in Sources */,
......
...@@ -40,20 +40,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -40,20 +40,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let navigationController: NavigationController = NavigationController(rootViewController: YellowViewController()) let navigationController: NavigationController = NavigationController(rootViewController: YellowViewController())
let navigationDrawerController: AppNavigationDrawerController = AppNavigationDrawerController(rootViewController: navigationController, leftViewController: AppLeftViewController(), rightViewController: AppRightViewController()) let navigationDrawerController: AppNavigationDrawerController = AppNavigationDrawerController(rootViewController: navigationController, leftViewController: AppLeftViewController(), rightViewController: AppRightViewController())
// navigationDrawerController.enabled = true
//
// navigationDrawerController.enabledLeftView = true
// navigationDrawerController.enabledLeftTapGesture = true
// navigationDrawerController.enabledLeftPanGesture = true
//
// navigationDrawerController.enabledRightView = true
// navigationDrawerController.enabledRightTapGesture = true
// navigationDrawerController.enabledRightPanGesture = true
let statusBarController: AppStatusBarController = AppStatusBarController(rootViewController: navigationDrawerController)
window = UIWindow(frame: UIScreen.mainScreen().bounds) window = UIWindow(frame: UIScreen.mainScreen().bounds)
window!.rootViewController = statusBarController window!.rootViewController = navigationDrawerController
window!.makeKeyAndVisible() window!.makeKeyAndVisible()
return true return true
} }
......
...@@ -38,34 +38,38 @@ class AppNavigationDrawerController: NavigationDrawerController, NavigationDrawe ...@@ -38,34 +38,38 @@ class AppNavigationDrawerController: NavigationDrawerController, NavigationDrawe
} }
func navigationDrawerPanDidBegin(navigationDrawerController: NavigationDrawerController, point: CGPoint, position: SideNavigationPosition) { func navigationDrawerPanDidBegin(navigationDrawerController: NavigationDrawerController, point: CGPoint, position: SideNavigationPosition) {
showStatusBarView() print("NavigationDrawerController - Pan Began");
} }
func navigationDrawerPanDidEnd(navigationDrawerController: NavigationDrawerController, point: CGPoint, position: SideNavigationPosition) { func navigationDrawerPanDidEnd(navigationDrawerController: NavigationDrawerController, point: CGPoint, position: SideNavigationPosition) {
hideStatusBarView() print("NavigationDrawerController - Pan Ended");
} }
func navigationDrawerWillOpen(navigationDrawerController: NavigationDrawerController, position: SideNavigationPosition) { func navigationDrawerWillOpen(navigationDrawerController: NavigationDrawerController, position: SideNavigationPosition) {
showStatusBarView() print("NavigationDrawerController - Will Open");
}
func navigationDrawerDidOpen(navigationDrawerController: NavigationDrawerController, position: SideNavigationPosition) {
print("NavigationDrawerController - DId Open");
} }
func navigationDrawerWillClose(navigationDrawerController: NavigationDrawerController, position: SideNavigationPosition) { func navigationDrawerWillClose(navigationDrawerController: NavigationDrawerController, position: SideNavigationPosition) {
hideStatusBarView() print("NavigationDrawerController - Will Close");
}
func navigationDrawerDidClose(navigationDrawerController: NavigationDrawerController, position: SideNavigationPosition) {
print("NavigationDrawerController - Did Close");
}
func navigationDrawerStatusBarHiddenState(navigationDrawerController: NavigationDrawerController, hidden: Bool) {
print("NavigationDrawerController - Status Bar Hidden: ", hidden ? "Yes" : "No");
} }
/// Shows the transparent statusBarView. func navigationDrawerDidTap(navigationDrawerController: NavigationDrawerController, point: CGPoint, position: SideNavigationPosition) {
private func showStatusBarView() { print("NavigationDrawerController - Did Tap");
statusBarController?.statusBarStyle = .LightContent
UIView.animateWithDuration(0.25, animations: { [weak self] in
self?.statusBarController?.statusBarView.alpha = 1
})
} }
/// Hides the transparent statusBarView. func navigationDrawerPanDidChange(navigationDrawerController: NavigationDrawerController, point: CGPoint, position: SideNavigationPosition) {
private func hideStatusBarView() { // print("NavigationDrawerController - Did Change");
statusBarController?.statusBarStyle = .Default
UIView.animateWithDuration(0.25, animations: { [weak self] in
self?.statusBarController?.statusBarView.alpha = 0
})
} }
} }
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of Material nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
import Material
class AppStatusBarController: StatusBarController {
override func prepareView() {
super.prepareView()
statusBarView.alpha = 0
statusBarStyle = .LightContent
}
}
...@@ -114,9 +114,6 @@ public protocol NavigationDrawerControllerDelegate { ...@@ -114,9 +114,6 @@ public protocol NavigationDrawerControllerDelegate {
@IBDesignable @IBDesignable
@objc(NavigationDrawerController) @objc(NavigationDrawerController)
public class NavigationDrawerController : UIViewController, UIGestureRecognizerDelegate { public class NavigationDrawerController : UIViewController, UIGestureRecognizerDelegate {
/// A Boolean to determine if the statusBar will be hidden.
private var willHideStatusBar: Bool = false
/** /**
A CGFloat property that is used internally to track A CGFloat property that is used internally to track
the original (x) position of the container view when panning. the original (x) position of the container view when panning.
...@@ -169,22 +166,6 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD ...@@ -169,22 +166,6 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
@IBInspectable public var rightThreshold: CGFloat = 64 @IBInspectable public var rightThreshold: CGFloat = 64
private var rightViewThreshold: CGFloat = 0 private var rightViewThreshold: CGFloat = 0
/// Sets the animation type for the statusBar when hiding.
public var statusBarUpdateAnimation: UIStatusBarAnimation = .Fade
/// Sets the statusBar style.
public var statusBarStyle: UIStatusBarStyle = .Default
/// Sets the statusBar to hidden or not.
public var statusBarHidden: Bool {
get {
return MaterialDevice.statusBarHidden
}
set(value) {
MaterialDevice.statusBarHidden = value
}
}
/** /**
A NavigationDrawerControllerDelegate property used to bind A NavigationDrawerControllerDelegate property used to bind
the delegation object. the delegation object.
...@@ -304,7 +285,10 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD ...@@ -304,7 +285,10 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
A Boolean property that triggers the status bar to be hidden A Boolean property that triggers the status bar to be hidden
when the leftView is opened. Defaults to true. when the leftView is opened. Defaults to true.
*/ */
@IBInspectable public var enableHideStatusbar: Bool = false @IBInspectable public var enableHideStatusbar: Bool = true
/// Sets the statusBar to hidden or not.
public private(set) var statusBarHidden: Bool = false
/** /**
A MaterialDepth property that is used to set the depth of the A MaterialDepth property that is used to set the depth of the
...@@ -409,18 +393,6 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD ...@@ -409,18 +393,6 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
} }
} }
public override func preferredStatusBarUpdateAnimation() -> UIStatusBarAnimation {
return statusBarUpdateAnimation
}
public override func prefersStatusBarHidden() -> Bool {
return willHideStatusBar
}
public override func preferredStatusBarStyle() -> UIStatusBarStyle {
return statusBarStyle
}
/** /**
A method to swap rootViewController objects. A method to swap rootViewController objects.
- Parameter toViewController: The UIViewController to swap - Parameter toViewController: The UIViewController to swap
...@@ -907,7 +879,13 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD ...@@ -907,7 +879,13 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
/// A method that prepares the rootViewController. /// A method that prepares the rootViewController.
private func prepareRootViewController() { private func prepareRootViewController() {
prepareViewControllerWithinContainer(rootViewController, container: view) let vc: UIViewController = UIViewController()
vc.view.frame = view.bounds
vc.view.backgroundColor = MaterialColor.black
prepareViewControllerWithinContainer(vc, container: view)
rootViewController.view.frame = view.bounds
prepareViewControllerWithinContainer(rootViewController, container: vc.view)
} }
/// A method that prepares the leftViewController. /// A method that prepares the leftViewController.
...@@ -1083,15 +1061,15 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD ...@@ -1083,15 +1061,15 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
/// Shows the statusBar. /// Shows the statusBar.
private func showStatusBar() { private func showStatusBar() {
if statusBarHidden { if statusBarHidden {
UIView.animateWithDuration(NSTimeInterval(UINavigationControllerHideShowBarDuration), statusBarHidden = false
animations: { [weak self] in dispatch_async(dispatch_get_main_queue(), { [weak self] in
if let s: NavigationDrawerController = self { if let s: NavigationDrawerController = self {
s.statusBarHidden = false if let v: UIWindow = UIApplication.sharedApplication().keyWindow {
s.willHideStatusBar = false v.windowLevel = UIWindowLevelNormal
s.setNeedsStatusBarAppearanceUpdate() s.delegate?.navigationDrawerStatusBarHiddenState?(s, hidden: false)
}
} }
}) })
delegate?.navigationDrawerStatusBarHiddenState?(self, hidden: false)
} }
} }
...@@ -1099,15 +1077,15 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD ...@@ -1099,15 +1077,15 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
private func hideStatusBar() { private func hideStatusBar() {
if enableHideStatusbar { if enableHideStatusbar {
if !statusBarHidden { if !statusBarHidden {
UIView.animateWithDuration(NSTimeInterval(UINavigationControllerHideShowBarDuration), statusBarHidden = true
animations: { [weak self] in dispatch_async(dispatch_get_main_queue(), { [weak self] in
if let s: NavigationDrawerController = self { if let s: NavigationDrawerController = self {
s.statusBarHidden = true if let v: UIWindow = UIApplication.sharedApplication().keyWindow {
s.willHideStatusBar = true v.windowLevel = UIWindowLevelStatusBar + 1
s.setNeedsStatusBarAppearanceUpdate() s.delegate?.navigationDrawerStatusBarHiddenState?(s, hidden: true)
}
} }
}) })
delegate?.navigationDrawerStatusBarHiddenState?(self, hidden: true)
} }
} }
} }
...@@ -1181,8 +1159,6 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD ...@@ -1181,8 +1159,6 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
/// Layout subviews. /// Layout subviews.
private func layoutSubviews() { private func layoutSubviews() {
rootViewController.view.frame = view.bounds
if let v: MaterialView = leftView { if let v: MaterialView = leftView {
v.width = leftViewWidth v.width = leftViewWidth
v.height = view.bounds.height v.height = view.bounds.height
......
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