I call a webservice and get a nice JSON in return. This JSON lists a couple of reports with category.
The big question is how I can make a nice looking tableview with this, grouped by category. Im new to iOS, and I am really stucked at this point.
I save the json in an array like this:
tableData = [NSJSONSerialization JSONObjectWithData:dataWebService options:kNilOptions error:&error];
And then I sort the list:
NSArray *sortedArray;
NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"Category" ascending:YES];
sortedArray = [tableData sortedArrayUsingDescriptors:[NSArray arrayWithObject:descriptor]];
The json I get is this:
{
Category = Faktura;
about = "Fakturablankett med giro med utvalg p\U00e5 fra-til fakturanr";
name = Faktura;
reportendpoint = "https://unionline.unimicro.no/uni24Report/Report.aspx";
reportid = 16;
},
{
Category = Faktura;
about = "Fakturablankett med giro med utvalg p\U00e5 fra-til fakturanr";
name = "Faktura med sidenummer";
reportendpoint = "https://unionline.unimicro.no/uni24Report/Report.aspx";
reportid = 19;
},
{
Category = Faktura;
about = "Liste over fakturaer med status og mva-detaljer. Utvalg p\U00e5 fra-til fakturanr.";
name = Fakturajournal;
reportendpoint = "https://unionline.unimicro.no/uni24Report/Report.aspx";
reportid = 15;
},
{
Category = "Journaler og Kontoutskrifter";
about = "";
name = "Kontoutskrift hovedbok";
reportendpoint = "https://unionline.unimicro.no/uni24Report/Report.aspx";
reportid = 4;
},
{
Category = "Journaler og Kontoutskrifter";
about = "";
name = "Kontoutskrift kunder";
reportendpoint = "https://unionline.unimicro.no/uni24Report/Report.aspx";
reportid = 5;
}
I would like to list these "name" in a tableview, grouped by "Category". I need to sort the category an list the reports who belongs to these categories.
There is many more categories, but I didn´t paste them all.