here is my data pattern and i want to create an array of sections, in which case, each section will include an array of rows in that section. I looked at the following questions:
and a few other posts but could get no result. Can anyone please guide me how to create an array of sections, and each section shall include its own rows.. Thanks in advance
EDIT
I have allready parsed my data, the log result at the pastebin link is an NSDictionary
here is how i fetch&parse it:
NSString*key1=[ result objectForKey:@"key" ];
NSString *s1=[@"http://" stringByAppendingString:server.text];
NSString *s2=[s1 stringByAppendingString:@"/ipad/button.php"];
NSURL *url2=[NSURL URLWithString:[s2 stringByAppendingString:[@"?key=" stringByAppendingString:key1]]];
NSData *data2=[NSData dataWithContentsOfURL:url2];
result2=[NSJSONSerialization JSONObjectWithData:data2 options:NSJSONReadingMutableContainers error:nil];
The result in pastebin is this: NSLog(@"Result: %@", result2);
Your data is in JSON format, so just use the
NSJSONSerializationclass to create the array of arrays for you.To use your array of sections in a table view, just use the usual table view
datasourcemethods: