У меня есть следующие данные JSON, которые отвечают на мой Web-сервис.Как отображать данные JSON в UITableView
{"d": [{"raumKlassenObject":"Telepresenzraum"},
{"raumKlassenObject":"Besprechungsraum"},
{"raumKlassenObject":"Videokonferenzraum"},
{"raumKlassenObject":"IT-Schulungsraum"},
{"raumKlassenObject":"Konferenzraum"}]}
Как я могу отобразить Telepresenzraum данных, Besprechungsraum и т.д ... в TableView.
Heres my Code до сих пор.
- (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 и т.д .. в Tableview строк.
Thx для справки.
thx это сработало. большое спасибо – Bashud