0

我正在使用 Json 解析数据,目前数据在字典中可用,并且它也可以在数组中使用,现在我想在表视图中显示该数据。可以请一些帮助。

4

1 回答 1

2
NSMutableDictionary* dicts = parseJSON;
...
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
{
    return dicts.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: @"myCell"];    
    if (cell == nil) {
        cell =  [[[ UITableViewCell alloc ] initWithFrame:CGRectZero] autorelease];
    }
    cell.textLabel = [[dicts objectIndex:indexPath.row] objectforkey:@"namefield"];
    return cell;
}
于 2012-12-10T10:44:58.047 回答