[英]Do locally created objects get released when their ViewController is dismissed?
I'm throwing up around 50 UIImageViews into a view via a loop, looks something like this (Photo is just my subclass):我通过循环将大约 50 个 UIImageViews 扔到一个视图中,看起来像这样(照片只是我的子类):
Photo *photoImage = [[Photo alloc] initWithImage:photo];
[self.view addSubview:photoImage];
My current design flow uses the presentViewController
and dismissViewController
to move along views.我当前的设计流程使用presentViewController
和dismissViewController
来移动视图。 When this I decide to dismiss this view, are these objects removed from memory and cleaned up?当我决定驳回这个观点时,这些对象是否从 memory 中移除并清理干净? Also, are my array objects removed when the viewController is dismissed, or am I suppose to be using viewDidUnload?此外,当 viewController 被关闭时,我的数组对象是否被删除,或者我是否应该使用 viewDidUnload?
I'm using ARC btw.我正在使用 ARC 顺便说一句。 Thanks谢谢
use Autorelease使用自动释放
Photo *photoImage = [[Photo alloc] initWithImage:photo]Autorelease]; Photo *photoImage = [[Photo alloc] initWithImage:photo]Autorelease];
[self.view addSubview:photoImage]; [self.view addSubview:photoImage];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.