Here's a hypothetical getter:
- (DetailViewController *)detailController
{
if (detailController == nil) {
DetailViewController *controller = [[DetailViewController alloc] initWithNibName:@"Detail" bundle:nil];
self.detailController = controller;
[controller release];
}
return detailController;
}
Then the code that calls it looks something such as:
- (void)loadControllerOrSomething
{
DetailViewcontroller *controller = self.detailController;
[navigationController doSomethingWith:controller];
}
My question regarding memory management is the following. If I let *controller go out of scope here, in loadControllerOrSomething, am I leaking memory? Should I be doing a controller = nil after working with navigationController?