【问题标题】:(nonatomic, readwrite, retain) and (nonatomic, strong) in Objective-C ARCObjective-C ARC 中的 (nonatomic, readwrite, retain) 和 (nonatomic, strong)
【发布时间】:2012-08-24 17:01:38
【问题描述】:

有什么不同吗?

假设它们和ARC中一样,retain应该换成strong?

那么我可以说它们是一样的吗?

【问题讨论】:

    标签: objective-c ios xcode automatic-ref-counting llvm


    【解决方案1】:

    不,没有区别。按照我的回答here

    • retain / strong:(自动保留/释放设置的值,确保值不会意外释放)(默认为 ARC 和对象类型)

    此外,readwrite 是属性的默认设置,因此这不是必需的,并且您已经指定了 nonatomic

    【讨论】:

      【解决方案2】:

      strong 替换了 retain 和类似的功能。如果它的一个对象弱替换分配(说引用该对象但不增加其引用计数),则两者之间的非原子是相同的

      【讨论】:

        猜你喜欢
        • 2013-03-20
        • 1970-01-01
        • 1970-01-01
        • 2013-02-26
        • 2011-07-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-05-03
        相关资源
        最近更新 更多