1, copy, use the type: nsstrings, block 2, assign the use of type: delegate, int, float, NSInteger, bool, enumeration, struct… Retain use type: NSArray,NSDate 4. Strong Use type: OC object other than NSString/block 5. Weak Use type: When two objects reference each other, one end uses strong and the other end uses weak. 6, readOnly: read-only (that is, only the getter method is needed); ReadWriete: Default property (getter&&setter methods)

  • assign ( ARC/MRC )Weak strong retain copy = retain strong retain copy = retain strong retain copy = retain strong retain copy = retain strong retain copy The default assign object will be the same as the strong object, but the counter of the strong object will not be assigned by 1. So Pointers don’t point to nil after objects are destroyed. Weak pointer error (weak)

– weak (ARC) 1, weak pointer is the modifier for object, which means it can’t modify the basic data types. 2, the weak modified object counter not + 1, Weak references are designed to break circular references. 4. Weak references are most popular because if the object they point to is destroyed, it points to nil. Nil doesn’t give a wild pointer error for anything.


  • strong ( ARC )1. Assign a value directly and the counter +1. 2.

  • retain ( MRC )Retain (counter +1) from set (counter +1) and retain (counter +1) from set (counter +1)
    if(_delegate) {[_delegate release]; } _delegate = [delegate retain];Copy the code

  • copy ( ARC/MRC )Copy (MRC) releases the old object (old object counter -1), copies the new object (new object counter +1), and points to the new object. Inside the set method it looks like this:
if(_delegate) {[_delegate release]; } _delegate = [delegate copy];Copy the code

Copy a new object (new object counter +1) and point to the new object. Inside the set method it looks like this:

_delegate = [delegate copy];
Copy the code

3, Use note: The modifier property itself is immutable. For example, NSMutableArray uses the copy modifier, adding elements that appear to crash as soon as they run because copy is actually an NSArray. We do not say you) comply with the NSCopying agreement for object use.


  • Nonatomic (ARC/MRC) (ARC/MRC) (ARC/MRC

  • 1. The generated set method is synchronized with a mutex.

@synchronized(self) {_delegate = delegate; }Copy the code

The mutex is implemented using thread synchronization to ensure that only one thread calls the set method at a time. So even using atomic decoration is not safe enough.


  • readonlyLet Xcode only generate get methods. 2. Use this method when you don’t want exposed attributes to be replaced.

  • readwriteGet Xcode to generate get/set methods.

  • getter/setter1, generally for properties such as yes/no yes/no, getter method name before is is easy to understand.