1, Introduction:
The property is a objective-c keyword, used in pairing with @synthesize , to allow the compiler to automatically generate a method declaration with the same name as the data member. @synthesize is the implementation that is used to generate the corresponding declaration method.
Syntax format for 1.1 property:
@property (parameter 1, Parameter 2) type name;
Here are the main parameters, the following three kinds:
Setter/getter Method (assign/retain/copy)
Read-write properties (readwrite/readonly)
Atomicity (nonatomic)
1.2 Three ways to use
The assign/retain/copy represents the way in which the value is assigned.
the ReadOnly keyword means that the setter will not be generated, so it cannot be used in combination with Copy/retain/assign .
The default value for Atomicity is Atomic, and the Read function is atomic.
1.2.1 Copy/reain/assign in which to select a setter to determine how the property handles this property. The NSObject object is used in this way.
1.2.2 Some special objects, such as nssstring, use copy.
The 1.2.3 assign keyword represents the setter's direct assignment, rather than copying or preserving it. For basic data types, such as Nsinteger and cgfloat, or types that you do not directly own, such as delegates.
Objective-c syntax of the @porpetry keyword