2010-11-05 36 views
1

我在我的应用程序中有一个NSPathControl,供用户在他的硬盘上选择一个文件。获取NSPathControl选定文件的完整路径

我想使用

-(IBAction) clickedPath:(id) sender { 

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

NSLog (@"%@", string); 

} 

但这仅输出文件名。我怎样才能获得文件的完整路径?

在此先感谢!

回答

4

尝试使用URL属性:

- NSString *string=[[pathControl URL] path]; 
+0

谢谢!这就是我一直在寻找的 – Knodel 2010-11-06 18:23:44