我想在表格视图中显示 fileNames 、 types 、 size ...。我试图显示文件名。表格视图由数据填充,但未显示。显示警告:'directoryContectsAtPath:' 已弃用。这是代码(.m 文件)。请帮忙
@implementation TableController
-(void) awakeFromNib{
[uploadTable setDataSource:self];
}
-(IBAction)showFiles:(id)sender{
[fileNames removeAllObjects];
[fileNames autorelease];
fileNames = [[NSMutableArray alloc] initWithArray:[[[NSFileManager defaultManager]directoryContentsAtPath:@"/"]retain]];
[uploadTable reloadData];
}
-(int)numberOfRowsInTableView:(NSTableView *)uploadTable{
return [fileNames count];
}
-(id)tableWiew:(NSTableView *)uploadTable objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row{
return [[fileNames objectAtIndex:row] stringValue];
}
@end