我有这个视图控制器(class1),其中有一个UICollectionView
。 当我完成这个视图时,我将进入下一个视图,但是我可以看到这个视图(class1)的内存消耗没有被清除并被添加到下一个视图(class2)中。删除viewController时清除内存
两个视图控制器与故事板制成,并有一个名字,当我用厂景(1类)完成我要去到下一个具有:
//in view1 i do when exit
UIViewController *mainV=[self.storyboard instantiateViewControllerWithIdentifier:@"MainView"];
mainV.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:mainV animated:YES completion:^(void)
{
[self.myCache removeAllObjects];//NSCache
[self.GridView removeFromSuperview]; //collection view
[self.view removeFromSuperview];
}];
看来,内存仍然不释放。 有没有另一种方法可以移动到下一个视图,并清除之前的一切?
设置为零的视图从内存中清除它 – Pawan