1.property function Usage
1: //@property: Setter and getter declarations that can automatically generate a member variable
2: int age; The declaration of a variable can be dispensed with directly
3: //-(void) Setage: (int) age;
4: //-(int) age;
2. Attention points
If you use the property but write your own get or set method, your own writing will overwrite the corresponding method of the system.
1: -(void) Setage: (int) age
2: {
3:
4: }
5:
6: //-(int) age
7: //{
8: //
9: //}
Ten:
One : //-(int) age
: //{
: // return;
: //}
1.set method Memory management-related parameters
* Retain:release old value, retain new value (for OC object type)
* Assign: Direct assignment (default, for non-OC object types)
* Copy : Release old value, copy new value
2. Whether to generate a set method
* ReadWrite: Generate both setter and Getter Declaration, implementation (default)
readonly : Only generate getter declarations, implementations
3. Multithreading Management
* Nonatomic: High performance (usually with this)
* Atomic : Low performance (default)
The name of the 4.setter and Getter methods
* Setter: Determines the name of the set method and must have a colon:
* Getter: Determines the name of the Get method (typically used in bool type)
Dark Horse programmer--"Dark Horse video Notes" OC Language foundation using Property optimization Package