【发布时间】:2011-01-19 21:27:54
【问题描述】:
这是来自探索 iPhone SDK 书籍的一段代码。它使用 2 个视图的示例。它会检查正在使用的视图并释放另一个视图。
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; // Releases the view if it
// doesn't have a superview
// Release anything that's not essential, such as cached data
if (self.blueViewController.view.superview == nil)
self.blueViewController = nil;
else
self.yellowViewController = nil;
}
我的问题是:如果我的应用有很多视图,例如 15 个,我是否需要像上面一样检查每个视图并释放未使用的视图?还是在这种情况下使用了不同的技术?`
【问题讨论】:
标签: iphone memory-management uiview uiviewcontroller