+(void)load;
官方解释:
https://developer.apple.com/documentation/objectivec/nsobject/1418815-load?language=occ
Invoked whenever a class or category is added to the Objective-C
runtime; implement this method to perform class-specific behavior upon
loading.
类或者分类一旦被加载到运行时,就会调用这个方法;一加载,就实现这个方法,来执行特定的行为。
因此,这个方法会执行的非常早,我们可以进行早期的处理。
The load message is sent to classes and categories that are both dynamically loaded and statically linked, but only if the newly loaded class or category implements a method that can respond.
一旦动态加载或者静态链接,load消息就会发送给类或者分类。但是只有新加载的类和分类实现了响应的方法。
A class’s +load method is called after all of its superclasses’ +load methods.
类的load方法会在所有父类的load方法之后调用;
A category +load method is called after the class’s own +load method.
分类的load方法会在类自己的load方法调用;
这个方法的用途:
类或者分类一旦被加载到运行时,就会调用这个方法;因为加载时间特别早:所以可以利用这个特性进行一些处理