Nonatomic: Non-atomic access, non-synchronous, multi-threaded concurrent access improves performance. If this attribute is not added, the default is two access methods are atomic transaction access.
(Atomic is a thread-protection technique used by OBJC, basically to prevent the data from being read by another thread when the write is not completed.) This mechanism is resource-intensive, so nonatomic is a very good choice on small devices such as the iphone, if there is no communication programming between multiple threads. )
Assign: Simple assignment, not changing index count
For underlying data types (Nsinteger) and C data types (int, float, double, char, and so on)
Copy: Create an object with an index count of 1 and then release the old object
To NSString
Retain: Frees the old object, assigns the value of the old object to the input object, and then increases the index count of the input object to 1
For other NSObject and its subclasses
The difference between copy and retain:
Copy is to create a new object, retain is to create a pointer to reference the object Count plus 1.
Eg: an NSString object with an address of 0x1111 with the content @ "STR"
Copy to another nsstring, the address is 0x2222, the content is the same, the new object retain is 1, the old object has not changed
Retain to another nsstring, the same address (set up a pointer, pointer copy), the content of course the same, the object's retain value +1
That is, retain is a pointer copy and copy is a copy of the content.
Summary Nonatomic,assigncopy,retain