1
假設我有一個屬性定義爲@property (copy) NSString *name
。如果一個屬性被定義爲副本,在分配給伊娃時是否還需要做一個副本?
假設我有一個init
方法定義如下。
-(instancetype) initWithName:(NSString *)name
{
self = [super init];
if (self)
{
_name = [name copy]; //Do I need this copy or will ARC do it automatically?
}
return self;
}
我需要複製的註釋行或將ARC處理它基於屬性聲明copy
就像它會在合成的制定者?