2

我的应用程序中有一个 NSPathControl 供用户选择他的硬盘上的文件。

我正在尝试使用

-(IBAction) clickedPath:(id) sender {

NSString *string=[[NSString alloc] initWithFormat:[[pathControl clickedPathComponentCell] stringValue]];

NSLog (@"%@", string);

}

但这仅输出文件名。如何获取文件的完整路径?

提前致谢!

4

1 回答 1

4

尝试使用 URL 属性:

- NSString *string=[[pathControl URL] path];
于 2010-11-06T15:48:29.117 回答