开发者

Removing the Proxy Icon in the bar of my mac app

开发者 https://www.devze.com 2023-03-31 02:15 出处:网络
I was wondering how to remove the proxy icon in the bar of my mac app. I\'ve added an image so you can see what Icon I\'m talk开发者_开发知识库ing about

I was wondering how to remove the proxy icon in the bar of my mac app. I've added an image so you can see what Icon I'm talk开发者_开发知识库ing about

Removing the Proxy Icon in the bar of my mac app

Thank you in advance!


The icon is included in the titlebar of the application automatically when you've created an NSDocument based application.

You can remove the proxy icon by returning nil from the -[NSWindow representedURL] method. This could be accomplished by using a custom NSWindow subclass with the method overridden; or simply setting the property to nil at the appropriate times.

Be aware, you might loose other functionality you normally get for free by changing this behavior, such as the dirty/clean indicator for the window, or some prompting to save when closing the window.

Alternatively, if you wanted a different image, you could use:

[[NSWindow standardWindowButton:NSWindowDocumentIconButton] setImage:customImage]

Then implement -[id<NSWindowDelegate> window:shouldPopUpDocumentPathMenu:] to return NO to prevent the popup menu from appearing.

If your application isn't actually document based, or the window doesn't represent a document, consider refactoring to present this window a different way, rather than being a document window.

There is some additional information in the Cocoa window documentation.

0

精彩评论

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