From a1be152975c712924d1bcd124ca5dfcb20da982b Mon Sep 17 00:00:00 2001 From: Kristijan Perusko Date: Mon, 8 Feb 2016 18:10:31 -0500 Subject: [PATCH] #111 Timer screen is now popped from the nav. stack before pushing Post design studio --- .../Base.lproj/Main.storyboard | 46 ++++++------------- .../PostDesignStudioViewController.swift | 14 ------ .../Subviews/UITabBarControllerBase.swift | 2 + 3 files changed, 15 insertions(+), 47 deletions(-) diff --git a/DesignStudioExpress/Base.lproj/Main.storyboard b/DesignStudioExpress/Base.lproj/Main.storyboard index 075bd7b..f8a3511 100644 --- a/DesignStudioExpress/Base.lproj/Main.storyboard +++ b/DesignStudioExpress/Base.lproj/Main.storyboard @@ -339,8 +339,7 @@ - - + @@ -1085,9 +1084,6 @@ Sketching Templates - - - @@ -1110,8 +1106,7 @@ Sketching Templates - - + @@ -1131,8 +1126,7 @@ Sketching Templates - - + @@ -1153,8 +1147,7 @@ Sketching Templates - - + @@ -2206,12 +2199,12 @@ Sketching Templates - + @@ -2223,12 +2216,12 @@ Sketching Templates - + @@ -3538,8 +3531,7 @@ Sketching Templates - - + @@ -3576,8 +3568,7 @@ Sketching Templates - - + @@ -3604,8 +3595,7 @@ Sketching Templates - - + @@ -3625,8 +3615,7 @@ Sketching Templates - - + @@ -3648,8 +3637,7 @@ Sketching Templates - - + @@ -4682,9 +4670,6 @@ Sketching Templates - - - @@ -4707,8 +4692,7 @@ Sketching Templates - - + @@ -4724,9 +4708,6 @@ Sketching Templates - - - @@ -4750,8 +4731,7 @@ Sketching Templates - - + diff --git a/DesignStudioExpress/Views/PostDesignStudioViewController.swift b/DesignStudioExpress/Views/PostDesignStudioViewController.swift index 6b7e7dc..7e6be0a 100644 --- a/DesignStudioExpress/Views/PostDesignStudioViewController.swift +++ b/DesignStudioExpress/Views/PostDesignStudioViewController.swift @@ -24,8 +24,6 @@ class PostDesignStudioViewController: UIViewControllerBase, UICollectionViewDele override func viewDidLoad() { super.viewDidLoad() - self.removeLastViewFromNavigation() - self.collectionView.registerClass(MHMediaPreviewCollectionViewCell.self, forCellWithReuseIdentifier: self.cellIdentifier) } @@ -36,18 +34,6 @@ class PostDesignStudioViewController: UIViewControllerBase, UICollectionViewDele } } - // to make back button always lead to the challenges screen - // remove all Timers and End screens from the nav stack - private func removeLastViewFromNavigation() { - let endIndex = (self.navigationController?.viewControllers.endIndex ?? 0) - 1 - if endIndex > 0 { - let previousVC = self.navigationController?.viewControllers[endIndex-1] - if previousVC is TimerViewController || previousVC is EndActivityViewController { - self.navigationController?.viewControllers.removeAtIndex(endIndex-1) - } - } - } - private func prepareViewState() { // set the title in the navbar self.navigationItem.title = vm.designStudioTitle diff --git a/DesignStudioExpress/Views/Subviews/UITabBarControllerBase.swift b/DesignStudioExpress/Views/Subviews/UITabBarControllerBase.swift index 9193fbc..853288a 100644 --- a/DesignStudioExpress/Views/Subviews/UITabBarControllerBase.swift +++ b/DesignStudioExpress/Views/Subviews/UITabBarControllerBase.swift @@ -180,6 +180,8 @@ class UITabBarControllerBase: UITabBarController { // add post view studio in the view hierarchy, so when the End design studio disappears // we will see the post studio screen if let postStudio = self.createPostDesignStudioViewController(notification) { + // remove the Timer screen from the stack first + self.dsNavController.popViewControllerAnimated(false) self.dsNavController.viewControllers.append(postStudio) } }