File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes iOS and the fly likes Retain Vs. Copy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Mobile » iOS
Bookmark "Retain Vs. Copy" Watch "Retain Vs. Copy" New topic
Author

Retain Vs. Copy

Anil Giri
Greenhorn

Joined: Jun 04, 2009
Posts: 9
I am wondering what should we be using, retain or copy with class members? Is copy operation heavier than retain?


SillyCon!
Pratik Goswami
Ranch Hand

Joined: Mar 02, 2009
Posts: 136

Hi Anil,

Anil Giri wrote:I am wondering what should we be using, retain or copy with class members? Is copy operation heavier than retain?

Copy is used generally for NSString. If the string is Mutable then it will be copied else it will be retained. Copy is a Call-By-Reference whereas Retain is Call-By-Value.
For both the case object's retain count will be increment by 1.

Thanks
Pratik Goswami


iOS * Android Developer
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retain Vs. Copy
 
Similar Threads
keeping the data in fields as itis even worng validations
FTP put options
Copy code to TextPad - no linefeeds??
This weeks Giveaway
Getting values from a hashmap using JSTL