Instance Method
インスタンスメソッド
isMemberOfClass:
Returns a Boolean value that indicates whether the receiver is an instance of a given class.
Required.
必須。
Technology
Objective-C Runtime
Objective-Cランタイム
Declaration
宣言
- (BOOL )isMemberOfClass: (Class )aClass ;
Parameters
パラメータ
aClass
A class object representing the Objective-C class to be tested.
Return Value
戻り値
YES
if the receiver is an instance of aClass
, otherwise NO
.
Discussion
解説
For example, in this code, isMemberOfClass:
would return NO
:
NSMutableData *myData = [NSMutableData dataWithCapacity:30 ];
id anArchiver = [[NSArchiver alloc] initForWritingWithMutableData:myData];
if ([anArchiver isMemberOfClass:[NSCoder class ]])
...
Class objects may be compiler-created objects but they still support the concept of membership. Thus, you can use this method to verify that the receiver is a specific Class object.
See Also
参照
Testing Object Inheritance, Behavior, and Conformance
- isKindOfClass:
Returns a Boolean value that indicates whether the receiver is an instance of given class or an instance of any class that inherits from that class.
Required.
必須。
- respondsToSelector:
Returns a Boolean value that indicates whether the receiver implements or inherits a method that can respond to a specified message.
Required.
必須。
- conformsToProtocol:
Returns a Boolean value that indicates whether the receiver conforms to a given protocol.
レシーバが指定したプロトコルに準拠するかどうかを指し示すブール値を返します。
Required.
必須。