- isKindOfClass:
- isMemberOfClass:
- conformsToProtocol:
Availability
Technology
- (BOOL)respondsToSelector:(SEL)aSelector;
aSelector
A selector that identifies a message.
YES
if the receiver implements or inherits a method that can respond to a
, otherwise NO
.
The application is responsible for determining whether a NO
response should be considered an error.
You cannot test whether an object inherits a method from its superclass by sending responds
to the object using the super
keyword. This method will still be testing the object as a whole, not just the superclass’s implementation. Therefore, sending responds
to super
is equivalent to sending it to self
. Instead, you must invoke the NSObject
class method instances
directly on the object’s superclass, as illustrated in the following code fragment.
You cannot simply use [[self superclass] instances
since this may cause the method to fail if it is invoked by a subclass.
Note that if the receiver is able to forward a
messages to another object, it will be able to respond to the message, albeit indirectly, even though this method returns NO
.
- isKindOfClass:
- isMemberOfClass:
- conformsToProtocol:
+ instancesRespondToSelector:
- forwardInvocation: