iOS中的load方法

+(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方法调用;

这个方法的用途:
类或者分类一旦被加载到运行时,就会调用这个方法;因为加载时间特别早:所以可以利用这个特性进行一些处理

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值