我正在阅读这段代码,其中setRegions
是在RootViewController
发布后调用的:我觉得有点奇怪:是不是意味着RootViewController
仍然可以访问,哪怕是发布和self.navigationController
“拥有”它呢?上述对象释放后调用方法?
- (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];
}
由于
谢谢亚历克斯韦恩的答案 – Paul 2012-04-05 01:24:05