2010-11-05 82 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