我正在将 JSON 解析到我的 MASTER-DETAIL 应用程序,并且在“深入挖掘”JSON 时遇到问题。我无法在我的detailTableView
. 在我的detailTableView
中,我想拥有酒店/旅馆的名称,在这种情况下。
查看我的 JSON 和 detailTableView.m:
[
{
"title": "Where to stay",
"pousadas":
[
{
"beach": "Arrastão",
"name": "Hotel Arrastão",
"address": "Avenida Dr. Manoel Hipólito Rego 2097",
"phone": "+55(12)3862-0099",
"Email": "hotelarrastao_reserva@hotmail.com",
"image": "test.jpg",
"latitude": "-23.753355",
"longitude": "-45.401946"
}
]
}
]
以及detailTableView.m中的tableView:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return self.stayGuide.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"detailCellStay"];
以下是我的试训:
NSString *pous = [self.stayGuide valueForKey:@"name"];
NSLog([self.stayGuide valueForKey:@"name"]);
cell.textLabel.text = pous;
return cell;
}
提前致谢!