2011-03-23 43 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