OC中有两个特殊的类方法,分别是load和initialize.本文总结一下这两个方法的区别于联系.使用场景和注意事项.Demo可以在我的Github上找到--load和initialize,如果觉得有帮助还望点个关注以示支持,总结在文章末尾. 先来看看NSObject Class Reference里对这两个方法说明: +(void)initialize The runtime sends initialize to each class in a program exactly one ti…
这篇文章来对比一下NSObject类的两个方法,+load与+initialize. + (void)load; Invoked whenever a class or category is added to the Objective-C runtime; implement this method to perform class-specific behavior upon loading. 不管一个类.类别是被动态加载或者静态链接,都会被发送load消息,但是只有新加入的类或者类别实现…