matghazaryan / AMSlideMenu2

Sliding Menu for iOS (Left and Right menus). Multiple storyboards and XIBs support.
MIT License
1.2k stars 194 forks source link

View Controllers recreated every time corresponding menu item is selected #104

Closed mrowles closed 9 years ago

mrowles commented 10 years ago

Hi,

I am trying to utilize the 'viewDidLoad' function on the default view from the SlideMenu, and noticed that each of the views gets re/instantiated every time we traverse through the menu. To understand my problem more clearly, I am trying to open/close the menu on initial loading of the app so that the user see's the navigation.

How is it possible to instantiate all of the views only once, at launch, but still only show the above functionality the first time the 'Home' view appears? Isn't it better practice to load the views only once?

I have set up my slider to manually perform segues as instructed elsewhere, but still unsure on where I need to actually set the view up and pass it as initialised.

- ( void ) tableView: ( UITableView * ) tableView didSelectRowAtIndexPath: ( NSIndexPath * ) indexPath
{
    UITableViewCell *cell = [ self.tableView cellForRowAtIndexPath:indexPath ];
    NSString *identifier = [ cell reuseIdentifier ];

    if ( [ identifier isEqual: @"Home" ] )
    {
        [ self performSegueWithIdentifier: @"homeSegue" sender: nil ];
        }
}

I was trying to follow this advice: https://github.com/ECSlidingViewController/ECSlidingViewController/issues/114

Thanks, Matt

arturdev commented 10 years ago

Check #53