Objective-c-NSObject Common methods

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.