Objective-C 数组

文章目录

1. 二维数组声明

		People *p00 = [[People alloc]initWithName:@"00"];
        People *p01 = [[People alloc]initWithName:@"01"];
        People *p02 = [[People alloc]initWithName:@"02"];
        NSArray *line0 = [NSArray arrayWithObjects:p00,p01,p02, nil];
        
        
        People *p10 = [[People alloc]initWithName:@"10"];
        People *p11 = [[People alloc]initWithName:@"11"];
        People *p12 = [[People alloc]initWithName:@"12"];
        NSArray *line1 = [NSArray arrayWithObjects:p10,p11,p12, nil];

        
        People *p20 = [[People alloc]initWithName:@"20"];
        People *p21 = [[People alloc]initWithName:@"21"];
        People *p22 = [[People alloc]initWithName:@"22"];
        NSArray *line2 = [NSArray arrayWithObjects:p20,p21,p22, nil];
        
        NSArray *ad = [NSArray arrayWithObjects:@"dd", nil];
        
        NSMutableArray <NSArray<People*>*> *aaa = [NSMutableArray arrayWithCapacity:0];
        
        [aaa addObject:line0];
        [aaa addObject:line1];
        [aaa addObject:line2];
发布了34 篇原创文章 · 获赞 20 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/ZhangWangYang/article/details/91866758