Returns a Boolean value that indicates whether the receiver is an instance of a given class.
Required.
必須。
Availability
iOS 2.0+
iPadOS 2.0+
macOS 10.0+
Mac Catalyst 13.0+
tvOS 9.0+
watchOS 2.0+
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:
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