nverinaud/NVSlideMenuController

Application Size Issue using NVSlideMenuController

balram3429 opened this issue · 1 comments

I am using this in my app & I am wondering what happens to the old view controller of same class, if it was already there in the navigation stack. Is that this control is returning the old instance or creating the new instance of the controller. Here is scenario.
I have my menu line "Home", "Search", About". When My app starts it comes to "home" viewcontroller. Now I click "About" & pass my aboutview controller. This will show me about controller. Now what happens to the "Home" which was there.. ? Is that still in stack & will be show if i choose "Home" from menu again ..?
Kindly clarify..?

What about making the changes to the method - (void)closeMenuBehindContentViewController:(UIViewController *)contentViewController animated:(BOOL)animated bounce:(BOOL)bounce completion:(void(^)(BOOL finished))completion like

Line 503
Use this
if ([contentViewController class] != [self.contentViewController class])
Instead of
if (contentViewController != self.contentViewController)

I see the effect that If I click my same menu item consecutively, the old instance is returned.

If I understand correctly, you have a NVSlideMenuController with 2 VCs :

  • your menu with 3 items : "Home", "Search" and "About", set to menuViewController
  • your first contentViewController with an instance for the "Home" stuff.

When you open the menu and touch "Home" again, you reinstanciate your HomeViewController and call - closeMenuBehindContentViewController:homeVC animated....
You would like the NVSlideMenuController to keep track of the old contentViewController so that it doesn't replace it with the new one if the new one is of the same class. You would like the NVSlideMenuController to simply close the menu.

It is your responsibility to keep track of the contentViewController. If you don't want it to be replaced you need to do the check by yourself like that :

// On "Home" touched
if ([self.slideMenuController.contentViewController isKindOfClass:[HomeViewController class]])
{
    [self.slideMenuController closeMenuAnimated:YES completion:nil];
}
else
{
    HomeViewController homeVC = /* get the new instance or reuse one */;
    [self.slideMenuController closeMenuBehindContentViewController:homeVC animated:YES ...];
}