Objective - c 创建二维数组

来源:互联网 发布:淘宝支付可以用花呗吗 编辑:程序博客网 时间:2024/04/29 21:05

NSArray     _sectionDataStr;_sectionDataStr = [[NSArray alloc] initWithObjects:                       [NSArray arrayWithObjects:@"Item1", @"Item2", nil],                       [NSArray arrayWithObjects:@"Item1", @"Item2", @"Item3", nil],                       [NSArray arrayWithObjects:@"Item1", @"Item2", @"Item3", @"Item4", nil],                       [NSArray arrayWithObjects:@"Item1", @"Item2", @"Item3", @"Item4", @"Item5",nil],                       nil];

打印:

    NSArray * array;    array = [_sectionDataStr objectAtIndex:0];    NSString* str = [array objectAtIndex:0];    NSLog(@"%@",str);

或:

NSLog(@"%@",[[_sectionDataStr objectAtIndex:0] objectAtIndex:0]);

输出结果是:

Item1

原创粉丝点击