NSArray属性:复制或保留? [英] NSArray property: copy or retain?
本文介绍了NSArray属性:复制或保留?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
根据此: NSString属性:复制或保留?
对于NSString / NSMutableString,建议使用copy。
NSArray / NSMutableArray如何?
<除非你有一个非常具体的原因,以及所有的支持代码/解决方案,否则选择
copy c>
我详细说明了基本原理和几个含义:
NSMutableString作为保留/复制
该示例基于 NSString
s,但同样适用于 NSArray
s。
According to this: NSString property: copy or retain?
For NSString/NSMutableString, copy is recommended.
How about NSArray/NSMutableArray?
解决方案
choose copy
, unless you have a very specific reason not to, as well as all the supporting code/interface to back that up.
i detailed the rationale and several implications here: NSMutableString as retain/copy
that example is based on NSString
s, but the same applies for NSArray
s.
这篇关于NSArray属性:复制或保留?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文