Macos 带有plist文件的NSTableView

Macos 带有plist文件的NSTableView,macos,cocoa,xcode4,nstableview,nswindowcontroller,Macos,Cocoa,Xcode4,Nstableview,Nswindowcontroller,我对mac应用程序开发非常陌生。所以只是做一些实际的练习 我想创建一个tableview,用于显示我的plist文件中的数据。 我有一个windowcontroller类和window controller.xib文件。 我将NSTableView拖放到.xib文件中。 并使用此代码加载plist文件 - (void)windowDidLoad { [super windowDidLoad]; NSBundle *bundle = [NSBundle mainBundle];

我对mac应用程序开发非常陌生。所以只是做一些实际的练习

我想创建一个tableview,用于显示我的plist文件中的数据。
我有一个windowcontroller类和window controller.xib文件。
我将NSTableView拖放到.xib文件中。
并使用此代码加载plist文件

- (void)windowDidLoad
{
    [super windowDidLoad];

    NSBundle *bundle = [NSBundle mainBundle];
    NSString *path = [bundle pathForResource:@"tenth" ofType:@"plist"];
    file = [[NSArray alloc] initWithContentsOfFile:path];

}
现在,我应该如何在tableview中显示行??
我必须使用哪种方法?怎么办

就像我们正在使用的IOS开发一样

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}

NSArray *temp = [file objectAtIndex:indexPath.row];
cell.textLabel.text = [temp objectAtIndex:0];
return cell;
}
您可以与
NSArrayController
或一起使用


推荐阅读:。

我认为您不希望用NSTableView表示属性列表。在OSX上,树通常用NSOutlineView表示。属性列表文件不是展开结构,展开它们将导致问题。。。