OC结构体
CGPoint p = {100, 100};//点
NSLog(@"x=%g,y=%g",p.x,p.y);

CGSize size = {100, 200};//大小
NSLog(@"width=%g,height=%g",size.width,size.height);

CGRect rect = {p, size};//矩形
NSLog(@"width=%g,height=%g",rect.size.width,rect.size.height);

NSRange range;//范围
range.location = 10;
range.length = 10;

//自定义
struct Person{
    int age;
};
struct Person person = {18};
NSLog(@"age:%d", person.age);



首页 我的博客
粤ICP备17103704号