How can I know whether an instance implements a method in Objective-C ?
Posted
by Thomas Joulin
on Stack Overflow
See other posts from Stack Overflow
or by Thomas Joulin
Published on 2010-04-04T17:56:26Z
Indexed on
2010/04/04
18:03 UTC
Read the original article
Hit count: 261
objective-c
I would like to know if an instance implements a specific method. I could use respondsToSelector:
but it returns YES if the instance inherits the method...
I could loop through the methods of class_copyMethodList()
, but since I might want to check a lot of instances, I wanted to know if there was a simpler solution (like repondsToSelector:
, but restricted to the class itself...)
© Stack Overflow or respective owner