Type Method 型メソッド

load()

Invoked whenever a class or category is added to the Objective-C runtime; implement this method to perform class-specific behavior upon loading. クラスまたはカテゴリがObjective-Cランタイムに加えられる時はいつでも発動します;このメソッドを実装して、クラス特有の挙動をロードすることで実行します。

Declaration 宣言

class func load()

Discussion 解説

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.

The order of initialization is as follows: 初期化の順番は以下になります:

  1. All initializers in any framework you link to. あなたがそれへとリンクする何らかのフレームワークの中の全てのイニシャライザ。

  2. All +load methods in your image.

  3. All C++ static initializers and C/C++ __attribute__(constructor) functions in your image.

  4. All initializers in frameworks that link to you. あなたへとリンクするフレームワークの中の全てのイニシャライザ。

In addition: 加えて:

  • A class’s +load method is called after all of its superclasses’ +load methods.

  • A category +load method is called after the class’s own +load method.

In a custom implementation of load() you can therefore safely message other unrelated classes from the same image, but any load() methods implemented by those classes may not have run yet.

See Also 参照

Initializing a Class クラスの初期化