获取NSPathControl选定文件的完整路径
问题描述:
我在我的应用程序中有一个NSPathControl,供用户在他的硬盘上选择一个文件。获取NSPathControl选定文件的完整路径
我想使用
-(IBAction) clickedPath:(id) sender {
NSString *string=[[NSString alloc] initWithFormat:[[pathControl clickedPathComponentCell] stringValue]];
NSLog (@"%@", string);
}
但这仅输出文件名。我怎样才能获得文件的完整路径?
在此先感谢!
答
尝试使用URL属性:
- NSString *string=[[pathControl URL] path];
谢谢!这就是我一直在寻找的 – Knodel 2010-11-06 18:23:44