typedef enum{
kCircle,
kRectangle,
kOblateSpheroid
} ShapeType;
typedef enum{
kRedColor,
kGreenColor,
kBlueColor
} ShapeColor;
typedef struct{
int x,y,width,height;
} ShapeRect;
typedef struct{
ShapeType type;
ShapeColor fillColor;
ShapeRect bounds;
} Shape;
ShapeRect rect0 = {0,0,10,30};
声明结构变量时,你可以一次性初始化该结构的所有元素。
在Objective-C里定义枚举和结构体
猜你喜欢
转载自iaiai.iteye.com/blog/2113686
今日推荐
周排行