[英](nonatomic, readwrite, retain) and (nonatomic, strong) in Objective-C ARC
Any difference? 有什么区别吗?
Suppose they are the same as in ARC, retain should be replaced by strong? 假设它们与ARC中的相同,保留应替换为强吗?
So can I say that they are the same? 所以我可以说他们是一样的吗?
No, there is no difference. 不,没有区别。 In accordance to my answer here : 根据我在这里的回答:
retain / strong
: (automatically retains / releases values on set, makes sure values do not deallocate unexpectedly) (default if ARC and object type)retain / strong
:(自动保留/释放集合中的值,确保值不会意外释放)(如果是ARC和对象类型,则为默认值)
Also, readwrite is the default for a property, so that isn't necessary, and you are already specifying nonatomic
. 同样,readwrite是属性的默认设置,因此这不是必需的,并且您已经在指定nonatomic
。
strong replaces retain and functions similar. 强大的替换保留和功能相似。 if its an object weak replaces assign(saying reference the object but do not incrment its reference count), nonatomic is the same between the two 如果其对象弱替换了assign(说是引用该对象但不增加其引用计数),则两者之间的非原子性相同
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.