简体   繁体   English

在tableView中显示数组中的数据

[英]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. 记录->记录列表->每个记录有9个不同的记录,以下是控制台的输出。

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. 我想在我的tableView中显示此数据。 Any ideas? 有任何想法吗?

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) 因此,这是在单元格的一行上显示目的地,状态,dateSent和消息的方式:(可能需要稍微缩小文本大小)

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]];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM