Two dimensional array in ios

ios, nsarray, objective-c

Solution

NSMutableArray *dataArray = [[NSMutableArray alloc] initWithCapacity: 3];

[dataArray insertObject:[NSMutableArray arrayWithObjects:@"0",@"0",@"0",nil] atIndex:0];
[dataArray insertObject:[NSMutableArray arrayWithObjects:@"0",@"0",@"0",nil] atIndex:1];
[dataArray insertObject:[NSMutableArray arrayWithObjects:@"0",@"0",@"0",nil] atIndex:2];

And this is how you select your value from array

NSMutableArray *subArray = [dataArray objectAtIndex:2];
NSLog(@"data : %@",[subArray objectAtIndex:0]);

Problem

I want to use two dimensional array in ios, for example I want to prepare an array for `tableview` datasource, `UITableViewCell array[sections][rows];` Something like this, and here I cant predeclare the size also. Thanks

Original source

Related problems