One, assign the object.
Distribution is the process of a kind of object birth. The best time is to get a piece of memory from the operating system and designate it as the location of the instance variable that holds the object. The result of sending a ALLOC message to a class is to allocate a chunk of memory that is large enough to hold all the instance variables within that class. While The Alloc method also initializes the memory area to 0. Because the various random bugs that are caused by uninitialized memory have plagued many languages, the Alloc method initializes the allocated memory to 0, all of the float type variables are initialized to 0.0, and all pointers are initialized to nil , all the bases belong to us.
Second, initialize the object.
Initializing a piece of memory from the operating system and preparing it for storing objects, the Init method (that is, the method that performs the initialization operation) almost always returns the object they are initializing.
Three, summary.
In cocoa, allocation and initialization are two separate operations: the class method from NSObject Alloc allocates a chunk of memory to the object and zeros it, and the instance method init is used to get an object and make it run.
Reference: "Objective-c Basic Course"
"Reading Notes" ios-object initialization