All classes in iOS need to inherit from NSObject or NSProxy. There are fewer analogies to NSProxy inheritance and they're not used in actual development and can be ignored. You can understand that NSObject is the base class for all classes.Copy the code

Several common methods are as follows

+ (instanceType)alloc The alloc method creates an NSObject and allocates memory to that object - (InstanceType)init Init is generally used to initialize the object + (void)load Load is automatically called at compile time, before the main method. The load method of the parent class is called first and then the methods of the subclass are called. Each class has an implementation and + (void)initialize is not called The initialize method is automatically called when the class calls a method for the first time. The initialize method of the parent class is called first and then the methods of the subclass are called. Each class has an implementation and the initialize method of the parent class is called onceCopy the code