Core Foundation Framework (1) Basic introduction

Source: Internet
Author: User

Most of the time in the development process is using the Uikit and foundation framework, Uikit provides controls such as UIView and UIButton, and the foundation provides data structures such as nsarray,nsdictionary, The combination of the two can solve most of the problems, but sometimes it requires the underlying framework, which usually starts with the core, such as the core Text,core graphics and core Video. They are all C-based APIs on the core Foundation.

The types in the Core Foundation are all opaque types (opaque type). Only object references can be used in the core foundation, and the base type Cftyperef is actually a void* type, so that defining certain variables as CFTYPEREF types can facilitate the polymorphism of some functions. (such as Cfequal,cfhash,cfrelease,cfretain functions)

In addition to cftyperef, other opaque types are structs, and the common combinations are as follows:

typedef const STRUCT __cfstring * CFSTRINGREF;

typedef STRCT __cfstring * CFMUTABLESTRINGREF;

This way the compiler can check for the correctness of the const, but be aware that this is not a true inheritance. In core Foudation, if a class has several subclasses, it is generally the void* type. For example, the Cfpropertylistref subclass has (Cfstring,cfdate,cfnumber). Fortunately this is not the case, most types are struct or const struct.

Core Foundation Framework (1) Basic introduction

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.