- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Create the navigation and view controllers
RootViewController *rootViewController = [[RootViewController alloc]
initWithStyle:UITableViewStylePlain];
UINavigationController *aNavigationController = [[UINavigationController alloc]
initWithRootViewController:rootViewController];
self.navigationController = aNavigationController;
[aNavigationController release];
[rootViewController release];
[rootViewController setRegions:[Region knownRegions]];
// Configure and display the window
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
}
Here, in the above code the reference 'rootViewController' is used to send the message 'setRegions:', even after the object has been released in the previous line.
if it's wrong then how the simulator is running without any crash? or if it's right then, again how?, I couldn't see a difference between autorelease & release.
SOURCE:- http://developer.apple.com/iphone/library/samplecode/TableViewSuite/listing12.html
TO DOWNLOAD:- developer.apple.com/iphone/library/samplecode/TableViewSuite/index.html