Changing the icon on the "window bar" Mac OS X
I was wondering how I could change the icon in the "window bar" of my Ma开发者_C百科c app. I've also added a picture of the icon I want to change, since I believe that "window bar" isn't the correct term.
I think it's called "proxy icon" and it's controlled by the NSWindow
method setRepresentedFilename:
The icon gets set automatically based on the type of the file that is represented by the icon.
Be aware that the icon can be dragged by the user (as a file), so only use this, as the method name suggests, to set the file that the window represents. If you're coming from Windows, you might be tempted to put your app icon in there. Don't.
You'll want to use -setRepresentedFilename:
or the other similar methods. I don't think you can just change the icon to anything, it has to be associated with a file.
精彩评论