NSObject Common methods
- -(BOOL) Iskindofclass: (Class) AClass//To determine whether an instance of AClass or AClass subclass, AClass can be obtained by [class name class]
- -(BOOL) Ismemberofclass: (Class) AClass//Determine if the instance is AClass (excluding AClass subclasses)
- -(BOOL) Conformstoprotocol: (Protocol) Aprotocol//Determine if the object implements the Aprotocol protocol
- + (BOOL) Instancesrespondtoselector: (SEL) aselector//Determine if the object of this class has a method provided by the parameter Aselector
- -(BOOL) Respondstoselector: (SEL) aselector//Determine if the object has the method provided by the parameter Aselector
- -(void) Performselector: (SEL) Aselector withobject: (ID) anargument afterdelay: (nstimeinterval) delay//Delay call parameter provided method, Method required parameters are passed in Withobject
Reflection
Instantiating an object as a string of a class name
Class class = Nsclassfromstring (@ "Student");
Student *stu = [[Class alloc] init];
Turn the class name into a string
Class class = [Student class];
NSString *classname = Nsstringfromclass (Class);
- The reflection of the SEL
Instantiating methods by string form of a method
SEL selector = nsselectorfromstring (@ "setName:");
[Stu Performselector:selector withobject:@ "Mike"];
Turn a method into a string
Nsstringfromselector (@selector (setName:));
OBJECT-C syntax-nsobject common methods and reflections