iphone - 在tableView中显示数组中的数据

标签 iphone objective-c cocoa-touch ios

我有一个如下所示的数组。

记录 -> 记录列表 -> 每条记录有 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 中显示这些数据。有什么想法吗?

最佳答案

正如您在其他问题中所发布的,以下是您制作数组的方式:

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

因此,以下是您如何在单元格的一行上显示目的地、状态、发送日期和消息:(可能需要稍微缩小文本大小)

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

关于iphone - 在tableView中显示数组中的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5409177/

相关文章:

ios - Swift 无法使具有标识符 Cell 的单元出列 - 必须为标识符注册一个 Nib 或一个类,或者在 Storyboard中连接一个原型(prototype)单元

ios - UIWebView 第一次在特定的 UIViewController 中显示时加载速度非常慢

ios - 如何使用 Objective-C 对 TableView 存储的数据进行排序?

objective-c - 将多维 NSMutableArray 中的数据提取到更简单的数组中

iphone - 在 coregraphics 中添加投影 - 超出上下文范围?

iphone - 确定 AVPlayer 比特率

iphone - quartz 2d/核心图形 : What is the right way to draw some text?

iphone - 如果我转换 View 框架, subview 框架如何变化?

ios - Xcode中如何知道Objective-C语言版本

ios - Cocoa Touch 获取用户全名