读书人

构造体

发布时间: 2012-08-02 11:35:26 作者: rapoo

结构体

Hello World_Prefix.pch:扩展名.pch表示"precompiled header",这是一个你工程要用到的来自于外部框架的头文件列表。xcode将编译这些头到文件,这将减少你在选择Build 或Build and Go时编译项目的时间。通常用到的头文件已经自动包含了?

?

在pch中可以定义结构体

?

?

//声明一个BOX结构体struct BOXRect {    BOOL channel1;    BOOL channel2;};typedef struct BOXRect BOXRect;//static inline 相当于声明一个static函数static inline BOXRectBOXRectMake(BOOL c1, BOOL c2){    BOXRect rect;    rect.channel1 = c1;    rect.channel2 = c2;    return rect;}

?这样就可以在工程中随意使用该结构体了。类似CGRect。。。。

?

读书人网 >移动开发

热点推荐