I have read the guidelines for contributing and I understand:
First, thank you for making this public, it is incredible.
Anyway, here we go, I initiated SideMenu via the storyboard. When I tap on the "menu" button in my view controller the menu slides in perfectly with the added modifications available through SideMenuManager. When I select an option in the menu I have it presenting modally another view controller. The issue comes from hitting the "menu" button on this new view controller--the menu is no longer presented as it was the first time (sliding in from left to right), instead it appears to just appear modally over the top of the view controller. I get the same warning you spoke to before --> (https://github.com/jonkykong/SideMenu/issues/194) ("SideMenu Warning: menuLeftNavigationController cannot be modified while it's presented."). I tried to initialize the menuLeftNavigationController in the AppDelegate as suggested but it still is "ignoring" the presentation properties. I have tried calling the menuLeftViewController from the new view controller a few different ways but still am getting the same result. Am I interpreting the error message wrong? Or, am I just an idiot missing something simple? lol! Thank you in advance for any insight here!
For simplicity, SideMenu is a singleton, meaning it is globally defined once. When you modally present a screen over SideMenu, the menu is still in the view hierarchy, even though visually it appears not to be through the animations. Therefor when you try to present the menu again from the modal screen, it can't be shown because it is already being displayed. It will only stop being displayed once you dismiss the modal screen.
From a design perspective, this is desirable since showing the same menu from a modal screen can create havoc from the user's perspective since they can get buried in a stack of modal or pushed screens without a clear idea of how to get back where they were, and it can also keep many view controllers in memory. The simple way to think of it is that the menu 'belongs' to the level of the hierarchy in which it is displayed like a TabBarController, and shouldn't be used in other levels (displaying a modal screen creates a new level).
If you must change this behavior, your options are:
let newViewController = storyBoard.instantiateViewController(withIdentifier: controller)
self.dismiss(animated: true) { () -> Void in
//Perform segue or push some view with your code
UIApplication.shared.keyWindow?.rootViewController = newViewController
}
let newViewController = storyBoard.instantiateViewController(withIdentifier: controller) self.dismiss(animated: true) { () -> Void in //Perform segue or push some view with your code UIApplication.shared.keyWindow?.rootViewController = newViewController }
@j0cker MAN!!! THANK YOU SO MUCH 馃檹馃徏馃檶
Most helpful comment