【问题标题】:How to Get Plist Data and Display in UITableView?如何获取 Plist 数据并在 UITableView 中显示?
【发布时间】:2012-10-18 17:41:43
【问题描述】:

我在 plist 中有一些数据。首先我想获取 plist 数据,然后在 UITableview 中显示。 我的plist序列就是这样的

根...........字典

项目 0-9.......数组。

在 ViewDidload 中,我的代码如下所示。

NSString *path = [[NSBundle mainBundle] pathForResource:@"Movies" 
                                                 ofType:@"plist"];

NSDictionary *dic = [[NSDictionary alloc] initWithContentsOfFile:path];

这让我很困惑,如何将我的 Array 项传递给 UITableview。 谁能帮我提前在 UITableview.Thanx 中显示所有这些数据。

【问题讨论】:

    标签: iphone xcode uitableview plist


    【解决方案1】:

    如果要获取 A 部分的数组:

    NSArray *arrayForA = (NSArray *)[dic objectForKey:@"A"];
    

    然后,您将拥有一个可以在 UITableView 中显示的项目数组。 B 和 C 相同。

    如果您想将它们显示为部分,那么我将构建一个数组数组。

    如果您在实际制作和显示 UITableView 时需要帮助,请查看 Apple 的 Table View Programming Guide

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多