开发者

Display Opened Document's Path at Startup in NSPathControl object

开发者 https://www.devze.com 2022-12-08 08:14 出处:网络
My project is a doc based application. I\'d like to us开发者_JAVA百科e an NSPathControl object to display the path of the opened document at startup.

My project is a doc based application. I'd like to us开发者_JAVA百科e an NSPathControl object to display the path of the opened document at startup.

I'd insert the code here:

- (void)windowControllerDidLoadNib:(NSWindowController *)windowController

Can someone point me to an example?


Assuming you have an outlet to the path control and you are calling this from your NSDocument subclass, you can just do this:

[pathControl setURL:[self fileURL]];

If you are calling this from your NSWindowController subclass then of course it would look like this:

[pathControl setURL:[[self document] fileURL]];


There are three examples listed in the documentation for NSPathControl

Could you be more specific about the problem you're having?

0

精彩评论

暂无评论...
验证码 换一张
取 消