你的位置:首页 > 软件开发 > 操作系统 > IOS杂笔- 7(类方法load与initialize的区别 浅析)

IOS杂笔- 7(类方法load与initialize的区别 浅析)

发布时间:2016-03-20 14:00:10
在介绍两种类方法之前,NSObject Class Reference里对这两个方法说明:+(void)initializeThe runtime sends initialize to each class in a program exactly one time just ...

在介绍两种类方法之前,NSObject Class Reference里对这两个方法说明:

+(void)initialize

The runtime sends initialize to each class in a program exactly one time just before the class, or any class that inherits from it, is sent its first message from within the program. (Thus the method may never be invoked if the class is not used.) The runtime sends the initialize message to classes in a thread-safe manner. Superclasses receive this message before their subclasses.

翻译:运行库在一个程序中每一个类的一个程序中发送一个初始化一次,或是从它继承的任何类中,都是在程序中发送第一条消息。(因此,当该类不使用时,该方法可能永远不会被调用。)运行时发送一个线程安全的方式初始化消息。收到这个消息之前,他们的子类父类。

+(void)load

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.

原标题:IOS杂笔- 7(类方法load与initialize的区别 浅析)

关键词:IOS

IOS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。