Function 関数

protocol_addMethodDescription

Adds a method to a protocol. あるメソッドをあるプロトコルに加えます。

Declaration 宣言

void protocol_addMethodDescription(Protocol *proto, SEL name, const char *types, BOOL isRequiredMethod, BOOL isInstanceMethod);

Parameters パラメータ

proto

The protocol you want to add a method to.

name

The name of the method you want to add.

types

A C string representing the signature of the method you want to add.

isRequiredMethod

A Boolean indicating whether the method is a required method of the proto protocol. If YES, the method is a required method; if NO, the method is an optional method.

isInstanceMethod

A Boolean indicating whether the method is an instance method. If YES, the method is an instance method; if NO, the method is a class method.

Discussion 解説

To add a method to a protocol using this function, the protocol must be under construction. That is, you must add any methods to proto before you register it with the Objective-C runtime (via the objc_registerProtocol function).

See Also 参照

Working with Protocols プロトコルを扱う