Commit 723ef9fa by M. Porooshani

Returned to new way to handle menu show/hide functionality

parent cb15b04c
...@@ -97,6 +97,22 @@ class AppMenuController: MenuController { ...@@ -97,6 +97,22 @@ class AppMenuController: MenuController {
openMenu() openMenu()
} }
} }
/// Shows the menuView.
func showMenu() {
menuView.animate(MaterialAnimation.animationGroup([
MaterialAnimation.rotate(rotation: 3),
MaterialAnimation.translateY(0)
]))
}
/// Hides the menuView.
func hideMenu() {
menuView.animate(MaterialAnimation.animationGroup([
MaterialAnimation.rotate(rotation: 3),
MaterialAnimation.translateY(150)
]))
}
/// Prepares the menuView. /// Prepares the menuView.
private func prepareMenuView() { private func prepareMenuView() {
......
...@@ -77,16 +77,14 @@ class ItemViewController: UIViewController { ...@@ -77,16 +77,14 @@ class ItemViewController: UIViewController {
sideNavigationController?.enabled = false sideNavigationController?.enabled = false
// Stops the scrollView contentInsets from being automatically adjusted. // Stops the scrollView contentInsets from being automatically adjusted.
automaticallyAdjustsScrollViewInsets = false automaticallyAdjustsScrollViewInsets = false
(menuController as? AppMenuController)?.hideMenu()
} }
override func viewDidAppear(animated: Bool) { override func viewWillDisappear(animated: Bool) {
super.viewDidAppear(animated) super.viewWillDisappear(animated)
(menuController as? AppMenuController)?.showMenu()
// Access the navigationItem.backButton here.
// navigationItem.backButton
} }
override func viewWillLayoutSubviews() { override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews() super.viewWillLayoutSubviews()
......
...@@ -73,10 +73,7 @@ class RecipesViewController: UIViewController { ...@@ -73,10 +73,7 @@ class RecipesViewController: UIViewController {
override func viewDidAppear(animated: Bool) { override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated) super.viewDidAppear(animated)
// Show the menuView. // Show the menuView.
menuController?.menuView.animate(MaterialAnimation.animationGroup([
MaterialAnimation.rotate(rotation: 3),
MaterialAnimation.translateY(0)
]))
} }
override func viewWillDisappear(animated: Bool) { override func viewWillDisappear(animated: Bool) {
...@@ -84,10 +81,7 @@ class RecipesViewController: UIViewController { ...@@ -84,10 +81,7 @@ class RecipesViewController: UIViewController {
// Disable the SideNavigation. // Disable the SideNavigation.
// Hide the menuView. // Hide the menuView.
menuController?.menuView.animate(MaterialAnimation.animationGroup([
MaterialAnimation.rotate(rotation: 3),
MaterialAnimation.translateY(150)
]))
} }
......
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