Unpacking packing
The array can only be loaded into objects, and many times we need to be like int or struct such loading at this time we need to disassemble the basic idea is to convert a similar int and structure to the corresponding object and then add the array, the export should be from the object type into the corresponding int or struct class @property Nsmutablearray *ages;self.ages=[nsmutablearray Array]; int x=1; NSNumber *objectnumber=x; [Self.ages Addobject:objectnumber]; NSNumber *newobjectnumer=self.ages[0];int Newx=[newonjectnumer Intvalue]; Page Jump Chapter Two page class for Secondviewcontroller static page general with storyboard create note to drink Viercontroller to associate at this time Secondviewcontroller *l1=[ Self.stroryboard instantiatedviewcontrollerwithidentifier:@ "Fill in the ID in storyboard here"]; [Self presentviewcontroller:l1 animated:yes completion:nil]; Jump back [self dismissviewcontroller:yes animated:nil] in the second chapter of the page; Memory Management Preliminary
Three methods of MRC manual memory management
Retain causes memory Count +1
Release causes memory Count-1
Copy copies a new object and the data of the previous object may be consistent but not the same object so memory Count +1
Autorelease: Automatically releases automatically when the variable is out of the auto-release pool (Autoreleasepool)
Auto-Release Pool There's a lot of invisible in the project
in the arc;
Retain (strong) first put the original value release and then the newly imported value retain
Assign (weak) General basic data type with int float memory count unchanged
ReadOnly will let the property generate only the Get method without set method;
Self.names=name the set method that is called on the left of the readonly error
Nssmutablearray *l1=self.names Self.names is called by the Get method on the right.
and multithreading-related
Nonatomic Non-atomic operation unsafe efficiency high non-multithreading all use
Atomic atomic operation thread is safe and inefficient only when multiple threads access data can you use this keyword
Create attribute time to write
@property (Nonatomic,strong) Nsmutablearray *friends;
@property (nonatomic) int *age;
String special case to write copy type
@property (nonatomic,copy) NSString *name; (If strong points to the same memory space and assigns him to a different variable,
They point to the same piece of memory, and if you change the beginning of the NSString, then it will be changed, so use copy.
Property declaration +1 executes dealloc when the current object is destroyed
Self.enemys=[[nsmutablearray Alloc]init]
Self.enemys=[nsmutablearray array]; There are many factory methods that add autorelease after executing the above alloc and init.
Summarize
1. Basic data type with assign or weak but because of the default so do not write
2. All object types (except NSString) are used with strong or retain
3.NSString with Copy
Unpacking and Packing page jump and memory management 0905 Lan Yi Education