IOS basics-alloc, init, and new methods, iosallocinitnew
Alloc: memory allocation.
Init: initialization.
New: instead of the above two functions: allocate memory and initialize.
Note:
1. In actual development, new is rarely used. Generally, when an object is created
[[ClassName alloc] init];
2. the difference is that when alloc allocates memory, zone is used to allocate memory to objects and the associated objects are allocated to an adjacent memory area, in this way, a small amount of memory is consumed during the call, improving the processing speed of the program.
3. new is not recommended. If new is used, the initialization method is fixed and only init can be used. Other initXX methods cannot be called.
4. Only the default init method can be used to complete initialization using the new method. Other customized initialization methods can be used using alloc.