Say I pass a UIViewController to a UINavigationController like so:
SettingsViewController *settingsRootView = [[SettingsViewController alloc] initWithNibName:@"SettingsViewController" bundle:nil];
SettingsNavigationController *settingsView = [[SettingsNavigationController alloc] initWithRootViewController:settingsRootView];
[settingsRootView release];
[self presentModalViewController:settingsView animated:YES];
[settingsView release];
I release my retain on the original UIViewController, settingsRootView, but settingsView holds a retain on it. When I dismiss settingsView, it should release itself and all of its children, but for some reason it’s not. Is there a way to tell my main application view that it’s done with settingsView to force my main view to release settingsView and all of its subviews?
To force your settingsView to release any controllers it is managing, call settingsView.viewControllers = nil.
But this should happen automatically when settingsView is released. Place a breakpoint in the dealloc method of your settingsView to ensure it is being released. Make sure dealloc is calling [super dealloc].