Web サービスからの応答である次の JSON データがあります。
{"d": [{"raumKlassenObject":"Telepresenzraum"},
{"raumKlassenObject":"Besprechungsraum"},
{"raumKlassenObject":"Videokonferenzraum"},
{"raumKlassenObject":"IT-Schulungsraum"},
{"raumKlassenObject":"Konferenzraum"}]}
Data Telepresenzraum、Besprechungsraum などを TableView に表示するにはどうすればよいですか。
これまでのところ、私のコードはここにあります。
- (void)viewDidLoad
{
[super viewDidLoad];
dic = [NSJSONSerialization JSONObjectWithData:result options:kNilOptions error:nil];
array = [dic allKeys];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return array.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.textLabel.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"d"]];
return cell;
}
私がそれを好きなら、Tableviewの出力は
[{"raumKlassenObject":"Telepresenzraum"},{"raumKlassenObject":"Besprechungsraum"},{"raumKlassenObject":"Videokonferenzraum"},{"raumKlassenObject":"IT-Schulungsraum"},{"raumKlassenObject":"Konferenzraum"}]
Telepresenzraum、Besprechungsraum、Videokonferenzraum などのみをテーブルビューの行に表示する方法がわかりません。
助けてくれてありがとう。