【发布时间】:2016-06-28 13:10:25
【问题描述】:
假设这种情况:
__weak UIImage *image = [self calculateImage];
// a few lines later...
image = [self calculateImageUsingAnotherProcess];
假设 calculateImage 和 calculateImageUsingAnotherProcess 返回强引用。
好的,在第一种情况下image 是weak,但第二种情况呢? image 会保持 weak 方面吗?
【问题讨论】:
-
据我所知,这是一种从强到弱的方式,图像(作为弱)将在内存中,直到强引用指向它。
-
什么?你解释的方式听起来像克林贡语,我的大脑融化了。 ??????
-
calculateImage 和 calculateImageUsingAnotherProcess 如何返回强引用。 ?图像对象很弱意味着它很弱,不管它指向什么
-
好吧,我的意思是定义上不弱。
-
声明一个弱局部变量没有任何意义,除非它被块捕获。
标签: ios iphone objective-c-blocks weak-references