How to show json data in table view in xcode

后端 未结 2 999
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-24 10:07

i am new to ios and am currently working in json. I am just using itunes top 10 albums which to be displayed in table view i received data i formatted and displayed in table vie

相关标签:
2条回答
  • 2021-01-24 10:58

    You need to add Thee label in your UITableViewCell.

    And fetch each Value as you needed. It is simple fetch as you fetch value of name and put it to relevant UILabel. You also need to expand size of your cell of UITableView by following method.

    -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath
    {
    
      return 80;// write as you need.
    }
    
    0 讨论(0)
  • 2021-01-24 11:01

    you have to use costum UITableviewCells

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BDCustomCell"];
    if (cell == nil) {
        // Load the top-level objects from the custom cell XIB.
        NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"BDCustomCell" owner:self options:nil];
        // Grab a pointer to the first object (presumably the custom cell, as that's all the XIB should contain).
        cell = [topLevelObjects objectAtIndex:0];
    }
    
    return cell;
    

    }

    0 讨论(0)
提交回复
热议问题