简体   繁体   English

(非原子,可读写,保留)和(非原子,强)在Objective-C ARC中

[英](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.

相关问题 Objective-C 声明的@property 属性(非原子、复制、强、弱) - Objective-C declared @property attributes (nonatomic, copy, strong, weak) 使一个属性变强,对于objective-c非原子 - making one property strong,nonatomic for objective-c @property 在 Objective-C 中保留、分配、复制、非原子性 - @property retain, assign, copy, nonatomic in Objective-C Objective-C中的非原子和只读属性 - nonatomic and readonly property in Objective-C Objective-C中原子/非原子的证据 - Evidence of atomic / nonatomic in Objective-C 在使用ARC的Objective-C中,我们通常只需要将非原子属性指定为属性属性吗? - In Objective-C with ARC, is it true that we usually only need to specify nonatomic as property attributes? 什么是C ++相当于Objective C“@property(nonatomic,retain)”? - What is the C++ equivalent of Objective C “@property (nonatomic, retain)”? Objective-C ARC:强vs保留,弱vs分配 - Objective-C ARC: strong vs retain and weak vs assign (保留,非原子)和(非原子,保留)任何差异? - (retain, nonatomic) and (nonatomic, retain) any difference? Xcode 3.2中的@property(非原子,保留)和Xcode 4.2中的@property(强,非原子)之间的区别 - Difference between @property(nonatomic, retain)in Xcode 3.2 and @property(strong, nonatomic) in Xcode 4.2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM