2011-03-23 41 views
0

我有一个数组,看起来如下。从数组显示数据在表查看

记录 - >记录列表 - >每个记录有9个不同的记录,下面是控制台的输出。

这是当我打印阵列到控制台

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" 
) 

,我想在我的tableView显示此数据会发生什么。有任何想法吗?

+0

Hellloooo和Lalalalala不应该引用字符串吗? – 2011-03-23 18:09:27

+0

请看这个问题 http://stackoverflow.com/questions/5406424/iphone-tbxml-looping-and-parsing-data – MrPink 2011-03-23 19:05:48

回答

1

,张贴在您的其他问题,这里是如何你让你的数组:

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

所以,这里是你将如何显示目的地,地位,dateSent和消息都在一行上你cell :(可能不得不缩小文本大小)

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

@MrPink:没问题!希望一切都适合你。 :) – 2011-03-23 19:04:03