1. Class is also an object
- Class is an object of type class object
- Definition of class type
- An arbitrary type that represents a Objective-c class
- typedef struct Objc_class *class;
- The class name represents the class object, and each class has only one class object
- Get Class object
- Get class objects two ways Person1 and Person2
- Class Person1 = [Person class];
- Person *p = [person new];
- Class Person2 = [P class];
- //Class object call class method
- Person *person3 = [Person1 new];
2. Loading methods and initialization methods for classes
- + (void) load; //called once when the class is loaded
- + (void) initialize; //Call once when using a class
+load Method:
- All classes and classifications are loaded when the program starts, and the +load method for all classes and classifications is automatically invoked
- The program starts by loading the parent class and then the subclass, that is, calling the +load method of the parent class before calling the +load method of the subclass
- Load the original class and reload the taxonomy first
- Regardless of whether the program is running with this class, +load is called to load
+initialize Method:
- The first time a class is used, such as creating an object, the +initialize method is called once
- A class invokes the +initialize method only once, calling the parent class before calling the Initialize method of the subclass
Synchronous push-face test-ios simple comprehension of the essence of class