MrPink
MrPink

Reputation: 1371

Display data from array in tableView

I have an array which looks as follows.

Records -> list of records -> each record has 9 different records below is the output from console.

this is what happens when i print the array to console

2011-03-23 17:21:25.003 twosmsapp[5189:207] (
    447879652048,
    SUCCESS,
    "2011-03-23T15:56:54.222Z",
    "2011-03-23T15:56:54.223",
    "",
    "2011-03-23T15:56:55.977",
    "2011-03-23T15:57:04.177",
    Lalalalala,
    "2011-03-23 15:56:54.450ZVCLMKDRWBETW84AL"
)
2011-03-23 17:21:25.004 twosmsapp[5189:207] (
    447790686158,
    SUCCESS,
    "2011-03-23T12:24:12.844Z",
    "2011-03-23T12:24:12.843",
    "",
    "2011-03-23T12:24:13.540",
    "2011-03-23T12:24:23.453",
    "Another test",
    "2011-03-23 12:24:12.937CFOCJHXSZIETW85TS"
)
2011-03-23 17:21:25.004 twosmsapp[5189:207] (
    447790686158,
    SUCCESS,
    "2011-03-23T09:22:36.339Z",
    "2011-03-23T09:22:36.340",
    "",
    "2011-03-23T09:22:37.257",
    "2011-03-23T09:22:48.290",
    Hellloooo,
    "2011-03-23 09:22:36.660BJJJFMCSZIETW85OO"
)

I'm wanting to display this data in my tableView. Any ideas?

Upvotes: 0

Views: 932

Answers (1)

sudo rm -rf
sudo rm -rf

Reputation: 29524

As posted in your other question, here is how you were making your array:

[records addObject:[NSArray arrayWithObjects:
                                  [TBXML textForElement:destination],
                                  [TBXML textForElement:status],
                                  [TBXML textForElement:guid],
                                  [TBXML textForElement:dateSub],
                                  [TBXML textForElement:dateToSend],
                                  [TBXML textForElement:dateSent],
                                  [TBXML textForElement:dateReceived],
                                  [TBXML textForElement:message],
                                  [TBXML textForElement:id],nil]]; 

So, here is how you would display the destination, status, dateSent, and message all on one line on your cell: (might have to shrink your text size a bit)

cell.textLabel.text = [NSString stringWithFormat:@"%@, %@, %@, %@",
                          [[records objectAtIndex:indexPath.row] objectAtIndex:0],
                          [[records objectAtIndex:indexPath.row] objectAtIndex:1],
                          [[records objectAtIndex:indexPath.row] objectAtIndex:5],
                          [[records objectAtIndex:indexPath.row] objectAtIndex:7]];

Upvotes: 1

Related Questions