基本上我有一个具有介绍性视图的应用程序。一旦你到达某个视图,之前的视图就根本无法访问,所以我想将它们从堆栈中删除并释放它们消耗的任何内存。做这个的最好方式是什么?现在我正在做类似的事情
NSMutableArray *allViewControllers = [NSMutableArray arrayWithArray:self.navigationController.viewControllers];
NSArray *allControllersCopy2 = [allViewControllers copy];
for (id object in allControllersCopy2) {
if([allControllersCopy2 indexOfObject:object] == ([allControllersCopy2 count] - 1)){
NSLog(@"IGNORE CURRENT VIEW");
}
else{
[allViewControllers removeObject:object];
[object release];
}
}
self.navigationController.viewControllers = allViewControllers;
[allControllersCopy2 release];
这真的会释放这些视图消耗的内存吗?还是只是从堆栈数组中删除视图?