NSObject Common methods
Used to determine whether a method is implemented in an object (encapsulated in a selector object)-(BOOL) respondstoselector:selector//used to determine whether a method is implemented in an object. The difference between this and the above is that the previous method can be used on the instance, and this method is used on the class. +(BOOL) instancesRespondtoselector: Selector-(ID)Performselector:selector-(ID)Performselector:(SEL)Aselector Withobject:(ID)Object -(ID)Performselector:(SEL)Aselector Withobject:(ID)Object1 Withobject:(ID)Object2; Call the method in the object, one without parameters, one parameter, two parameters-(BOOL)Conformstoprotocol:(Protocol *)Aprotocol; Determines whether an object implements a protocol +(BOOL)Conformstoprotocol:(Protocol *)protocol, ibid., Difference: Static and non-static-(nsstring *)Description Allows an object to return a string to describe its contents, equivalent to the ToString method in Java-(nsstring *)Debugdescription; Ibid. for debug +(Class)Superclass; Return Super Class object +(Class)Return class object +(void)Load Initialize Load +(void)Initialize Initialize Object-(ID)Init Initialize object, allocate memory +(ID)New Assigns a new receive class instance, sends it an INIT message, and returns the initialized object. +(ID)Allocwithzone:(nszone *)Zone; Allocates a memory space for an object in memory and sets the compiler class definition of the object it points to, returning the instance. +(ID)Alloc, which allocates memory space for an object in memory and sets the compiler class definition of the object it points to, returns the instance. -(void)Dealloc; Apply to classes to dispose of object instance variables and free dynamic memory
/* is used to determine if the object is a type that is not a parameter (the parameter can be the class of the parent Class) */-(BOOL)Iskindofclass:(Class) AClass;/* is used to determine if the object is a type that is not a parameter (the parameter cannot be a class of the parent Class) */-(BOOL)Ismemberofclass:(Class) AClass;/ * Determines whether the object is a subclass of the specified class * /+ (BOOL)Issubclassofclass:(Class) AClass;/ * To determine if the object complies with the protocol provided by the parameter * /-(BOOL)Conformstoprotocol:(Protocol*)Aprotocol;/ * is used to determine if an object has a method provided by the parameter * /-(BOOL)Respondstoselector:(SEL) aselector;/ * is used to determine if the caller's instance object has the provided method * /+ (BOOL)Instancesrespondtoselector:(SEL) aselector;/ * Delay invocation of the parameters provided by the method, parameters required parameters are passed in Withobject * /-(void)Performselector:(SEL) aselector Withobject:(ID) anargument Afterdelay:(nstimeinterval) delay;
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Objective-c-NSObject common methods