以 CGRect 为例,一般情况的初始化方式为:
CGRect rect = CGRectMake(0, 0, 30, 30);
使用简便式(C99结构体初始化语法)可以是这样:
CGRect rect = {.origin.x=0, .origin.y=0, .size.width=30, .size.height=30};
或
CGRect rect = {0, 0, 30, 30};
以 CGRect 为例,一般情况的初始化方式为:
CGRect rect = CGRectMake(0, 0, 30, 30);
使用简便式(C99结构体初始化语法)可以是这样:
CGRect rect = {.origin.x=0, .origin.y=0, .size.width=30, .size.height=30};
或
CGRect rect = {0, 0, 30, 30};