I have a viewController (let's call it VC1), which is displayed when the application starts, it has a menu button that opens modalVC, in modalVC there are three buttons that open VC1, VC2, VC3 (at VC2, VC3 also have this menu button )
I run my application (on VC1), I press on the menu button (modalVC), turn on VC1.
It turns out that I have now two VC1 open? Because every time I press on VC1, is added to the memory of 1-2 mb. How can I remove them from memory?
Must somehow after selecting the controller menu (modalVC) to remove all that was earlier ..how?
The transition from the menu on the VC1, VC2, VC3 do so: UINavigationController * navController = [[UINavigationController alloc] initWithRootViewController: VC1]; [self presentViewController: navController animated: YES completion: nil];
If i will push menu button and always select VC2 (10 times will do that) app will slow
i tried this after select VC in menu (modalVC)
NSMutableArray *allViewControllers = [NSMutableArray arrayWithArray: self.navigationController.viewControllers];
[allViewControllers removeAllObjects];
self.navigationController.viewControllers = allViewControllers;