1. Determine whether an object is of a certain type: (The parent class will also return Yes)
class ]
2. Determine whether an object is an instantiated object of a class (the parent class does not return YES)
class ]
3. Determine if an agreement has been implemented
Conformstoprotocol: @protocol (nscopying)
4. Determine if there is a method (can respond to this method)
Respondstoselector: @selector (showmessage:)
Dynamically generate a class
5. Generate a class from a class name
nsstring *[email protected] "Person" ; Class myclass=nsclassfromstring (className)
You can initialize a person object with MyClass
Person *person2=[[myclass Alloc]init]
6. Convert Type to String
class ]
7. Call the method based on the method name string
nsstring *[email protected] "ShowMessage:"//Method name stringSEL myselector=nsselectorfromstring (methodName); To create a Sel object from a method name string
Performselector:myselector withobject:@"hello,world!"//Execute Method 8. Convert method to String
Nsstringfromselector (Myselector)
IOS Reflex Action