更改NSWindow标题的图标

时间:2012-09-05 19:18:59

标签: objective-c nswindow nsdocument

我正在尝试使用

在运行时更改文档窗口的代理图标

[[[self window] standardWindowButton:NSWindowDocumentIconButton] setImage:img];

这已经执行但是info.plist中的设置覆盖了这一点。

什么是正确的地方。

1 个答案:

答案 0 :(得分:1)

NSWindow子类覆盖setRepresentedURL中,如下所示:

- (void)setRepresentedURL:(NSURL *)url
{
    [super setRepresentedURL:url];
    NSImage* img = ...
    [[self standardWindowButton:NSWindowDocumentIconButton] setImage:img];
}
相关问题