Object pointer: 1, the object pointer completes the specific function by manipulating the memory it points to
-When the object pointer points to nil, this object is called an empty object
-nil is the default value for the object pointer
-null object without any function or effect
2, gets the memory address that the object pointer points to
-Get through alloc or convenience builder
-Get through the method
* Local Object pointer
-Scope is bounded by curly braces
-{
ID obj;
}
* Global Object pointers
-member variables that are declared manually
-member variables for attribute declarations
* Local Object pointer
-Normal use (default)
-Temporary variables
* Global Object pointers
-Recommended use of all properties
-One object is part of another object
-common data that the entire object needs to use
-External Data Interface for objects
* Strong reference (default)
-pointer to an object with __strong or no identity
-Memory is not freed when used by this type of object pointer
* Return to zero weak references
-pointer to an object identified by __weak
-When memory is used by this type of object pointer, it may be released at any time
-the object pointer using this memory is set to nil after the memory is released
* Weak references
-pointer to an object identified by __unsafe__unretain
-Memory is released at any time and the object pointer is not set to nil
* Automatic release of the pool (can adjust the automatic release time)
[Email protected] {
Ikeuchi
}
is essentially a piece of code area, bounded by curly braces
* Auto-Release type Object
-pointer to an object identified by __autoreleasing
-The memory that is used or used by the object pointer is freed from the auto-free pool, regardless of whether the object pointer exists.
-by cooperating with the auto-release pool and delaying or releasing memory early
* Memory Management Specification
* General Conditions
-Except for special circumstances, it is the general situation
-Use strong type
* Special Type
-Cross Reference//strong reference loops
-reference chain closed loop//strong reference loop
-Returns the amount of memory address created by method
-Create a large number of objects within a loop through methods
———————— when the object is released, go to the Dealloc method
Convenience Builder
+ (Instancetype) student
{
__autoreleasing Student *s = [[Student alloc]init];
return s;
If you return a piece of memory through a method, the memory must be an object that has been used by autoreleasing
Basic data type bool type, int type, double type, with assign
August 19, 2015 09:54:45