Data types in the Objective-c

Source: Internet
Author: User

Navigation: Basic data Types Object Type ID Type 1. Basic Data TypesThe basic types in objective-c are the same as the basic types of C, mainly:Int,long,float,double,char,void,boolAnd so on. It is important to note that in the Foundation framework, the system aliases some data, such as:Nsintegeris long,CGFloatis double, andBOOLAs Objective-c is a superset of C, it is possible to use the C language construction type in OC, such as: arrays, structures, etc. * For basic data types, pointers are not required and manual recycling is not required, and the system is automatically reclaimed by the method execution end. 2. Object TypeThe data types of common object types are:-nslog-NSNumber-NSStringand nsmutablestring-Nsarrayand Nsmutablearray-nsset and nsmutableset-.nsdictionaryand Nsmutabledictionary 3.id Type:In the Objective-c,ID Typeis a unique data type that can be converted to any data type, that is, a variable of type ID can hold an object of any data type. In internal processing, this type is defined as a pointer to an object. is actually a pointer to an instance variable of such an object. ID is an object that points to any of the inherited NSObject classes. Because the ID is a pointer, you do not need to precede the asterisk * when using the ID. 4. Other Special data types(Nil, nil, SEL, etc.)NilSame as NULL in C, defined in Objc.h. Nil represents a Objective-c object, and the pointer to this object points to null. (Nothing is empty.)NilThe first uppercase nil is a little bit different from nil, and nil defines a class that points to an empty (note that class, not object)SELThe first contact when the teacher said to meet it to replace it with @selector, SEL is a type of "selector", which represents the name of a method. For example, the method of ordering an array in a call: Sortedarrayusingselector: (SEL), the SEL will appear and we can fill in the SEL@selector (compare:)Selector is followed by a method that you need to use. There are many not very common data types, I do not list the author.

Data types in the Objective-c

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.