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
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]);
set up an NSDictionary
and use an NSIndexPath
as the key for each cell
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With