I have a root view controller, which serves as a menu. When an item is selected it presents some full-screen data modally. When the back button is hit, the following code is executed:
In BoardViewController.m:
- (IBAction)menuButtonPressed:(id)sender
{
[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
}
It brings back nicely to the main menu. But after this I'd like to the dismissed view controller to be destroyed (like when you're using push/pop view controllers). I don't store any references of them, but they are still alive after dismissing. How can I fix it? (Using ARC.)
EDIT
In AppDelegate.m:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
MenuViewController *menuVC = [[MenuViewController alloc] init];
self.window.rootViewController = menuVC;
...
}
In MenuViewController.m:
- (IBAction)newGame:(id)sender
{
BoardViewController *boardVC = [[BoardViewController alloc] init];
boardVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:boardVC animated:YES completion:nil];
}
EDIT 2
Well, a non-weak delegate property caused the problem. Thanks for all!