Consider the following code in the initialiser of a class:
UIViewController* blankViewController=[[DisplayViewController alloc]
initWithNibName:@"Blank" bundle:nil];
self.nextView=blankViewController.view;
nextView
is a property that uses retain. Notice that blankViewController
was not released. If it were released, this would cause a crash as the view doesn't seem to keep a reference to the viewController
. I want the view controller to stick around as long as a reference to the view is kept. What is the nicest way to fix this memory leak?