<legend id='CPPq7'><style id='CPPq7'><dir id='CPPq7'><q id='CPPq7'></q></dir></style></legend>

  • <tfoot id='CPPq7'></tfoot>

    <small id='CPPq7'></small><noframes id='CPPq7'>

    • <bdo id='CPPq7'></bdo><ul id='CPPq7'></ul>
    1. <i id='CPPq7'><tr id='CPPq7'><dt id='CPPq7'><q id='CPPq7'><span id='CPPq7'><b id='CPPq7'><form id='CPPq7'><ins id='CPPq7'></ins><ul id='CPPq7'></ul><sub id='CPPq7'></sub></form><legend id='CPPq7'></legend><bdo id='CPPq7'><pre id='CPPq7'><center id='CPPq7'></center></pre></bdo></b><th id='CPPq7'></th></span></q></dt></tr></i><div id='CPPq7'><tfoot id='CPPq7'></tfoot><dl id='CPPq7'><fieldset id='CPPq7'></fieldset></dl></div>
      1. “复制"和“复制"有什么区别?和“保留"?

        What is the difference between quot;copyquot; and quot;retainquot;?(“复制和“复制有什么区别?和“保留?)

            • <tfoot id='htXY3'></tfoot>

                <tbody id='htXY3'></tbody>
            • <i id='htXY3'><tr id='htXY3'><dt id='htXY3'><q id='htXY3'><span id='htXY3'><b id='htXY3'><form id='htXY3'><ins id='htXY3'></ins><ul id='htXY3'></ul><sub id='htXY3'></sub></form><legend id='htXY3'></legend><bdo id='htXY3'><pre id='htXY3'><center id='htXY3'></center></pre></bdo></b><th id='htXY3'></th></span></q></dt></tr></i><div id='htXY3'><tfoot id='htXY3'></tfoot><dl id='htXY3'><fieldset id='htXY3'></fieldset></dl></div>
              <legend id='htXY3'><style id='htXY3'><dir id='htXY3'><q id='htXY3'></q></dir></style></legend>

                • <bdo id='htXY3'></bdo><ul id='htXY3'></ul>
                • <small id='htXY3'></small><noframes id='htXY3'>

                  本文介绍了“复制"和“复制"有什么区别?和“保留"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  NSStringcopyretain有什么区别?

                  - (void)setString:(NSString*)newString
                  {
                      string = [newString copy];
                  }
                  

                  推荐答案

                  在一般情况下,保留一个对象会将其保留计数增加一.这将有助于将对象保留在内存中并防止它被吹走.这意味着,如果您只持有它的保留版本,您就可以与传递给您的任何人共享该副本.

                  In a general setting, retaining an object will increase its retain count by one. This will help keep the object in memory and prevent it from being blown away. What this means is that if you only hold a retained version of it, you share that copy with whomever passed it to you.

                  无论你如何复制一个对象,都应该创建另一个具有重复值的对象.将此视为克隆.您不会与传递给您的任何人共享克隆.

                  Copying an object, however you do it, should create another object with duplicate values. Think of this as a clone. You do NOT share the clone with whomever passed it to you.

                  尤其是在处理 NSString 时,你可能无法假设给你一个 NSString 的人是真的给你一个 NSString.有人可能会给你一个子类(NSMutableString,在这种情况下),这意味着他们可能会在幕后修改值.如果您的应用程序依赖于传入的值,并且有人在您身上更改了它,您可能会遇到麻烦.

                  When dealing with NSStrings in particular, you may not be able to assume that whoever is giving you an NSString is truly giving you an NSString. Someone could be handing you a subclass (NSMutableString, in this case) which means that they could potentially modify the values under the covers. If your application depends on the value passed in, and someone changes it on you, you can run into trouble.

                  这篇关于“复制"和“复制"有什么区别?和“保留"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  what#39;s property copy means in Cocoa#39;s Framework?(like UITabBar#39;s items property)(Cocoa 框架中的属性副本是什么意思?(如 UITabBar 的 items 属性))
                  Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)
                  SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)
                  WebKit on th iPhone: is it possible to copy text to the clipboad with JavaScript(iPhone上的WebKit:是否可以使用JavaScript将文本复制到剪贴板)
                  Difference between retain and copy?(保留和复制的区别?)
                  Can`t copy file from bundle to documents directory in iOS(无法将文件从捆绑包复制到 iOS 中的文档目录)

                    <tbody id='mf0Jb'></tbody>

                  <legend id='mf0Jb'><style id='mf0Jb'><dir id='mf0Jb'><q id='mf0Jb'></q></dir></style></legend>
                  <i id='mf0Jb'><tr id='mf0Jb'><dt id='mf0Jb'><q id='mf0Jb'><span id='mf0Jb'><b id='mf0Jb'><form id='mf0Jb'><ins id='mf0Jb'></ins><ul id='mf0Jb'></ul><sub id='mf0Jb'></sub></form><legend id='mf0Jb'></legend><bdo id='mf0Jb'><pre id='mf0Jb'><center id='mf0Jb'></center></pre></bdo></b><th id='mf0Jb'></th></span></q></dt></tr></i><div id='mf0Jb'><tfoot id='mf0Jb'></tfoot><dl id='mf0Jb'><fieldset id='mf0Jb'></fieldset></dl></div>

                      <tfoot id='mf0Jb'></tfoot>
                      • <bdo id='mf0Jb'></bdo><ul id='mf0Jb'></ul>
                          1. <small id='mf0Jb'></small><noframes id='mf0Jb'>