この要点には、UITableView で使用する JSON データがあります: https://gist.github.com/786829
INPUT とマークされたデータを取得し、それを OUTPUT に再フォーマットして、UITableView のセクションで正確に表示できるようにします。これは、次のコードで行われます。
groups = [parsedData objectForKey:@"venues"];
NSArray * distinctTypes = [groups valueForKeyPath:@"@distinctUnionOfObjects.type"];
output = [NSMutableArray array];
for (NSString * type in distinctTypes) {
NSPredicate * filter = [NSPredicate predicateWithFormat:@"type = %@", type];
NSMutableDictionary *group = [[NSMutableDictionary alloc] init];
[group setObject:type forKey:@"type"];
[group setObject:[groups filteredArrayUsingPredicate:filter] forKey:@"venues"];
[output addObject:group];
}
これを行うより良い方法はありますか?INPUT は現在、このグループ化を自動的に行う sencha app リストに使用されています。