iOS使用Plist中的数据填充UITableView

我想用我的Data.plist文件的内容填充一个UTTableView 。 我需要加载到一个NSMutableArray 。 这是我来了多远:

(查看加载):

  NSString *PlistPath = [[NSBundle mainBundle] pathForResource:@"Data" ofType:@"plist"]; Array = [[NSMutableArray alloc] initWithContentsOfFile:PlistPath]; [Array addObject:[[NSMutableDictionary alloc] initWithObjectsAndKeys:@"Testing 1", @"name", nil]]; 

当然,在CellForRowAtIndexPath

 cell.textLabel.text = [Array objectAtIndex:indexPath.row]; 

我写在我的Data.plist文件(图片):

http://i.stack.imgur.com/Cs1xd.png

现在,当我运行该应用程序。 我的TableView保持空白。

感谢您的时间和帮助!

目前你的plist的根目录设置为Dictionary 。 首先将其更改为array

然后使用这个代码来显示数据:

 cell.textLabel.text = [[Array objectAtIndex:indexPath.row] objectForKey:@"name"];