【发布时间】:2010-10-11 03:08:49
【问题描述】:
在这段代码的最后:
UIViewController *viewController = [[UIViewController alloc] init];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
[viewController release];
[self presentModalViewController:navigationController animated:YES];
[navigationController release];
导航控制器像往常一样以模态显示,但是当我单击 viewController 上的按钮时,它会崩溃。实际上,viewController 的保留计数为 0。 如果我评论两个版本中的一个,一切都比预期的要好。 我几乎到处都能看到这段代码,有什么问题吗?
【问题讨论】:
标签: ios objective-c memory-management uinavigationcontroller