Kyle Kyle - 1 year ago 86
Objective-C Question

Cocoa icon for file type?

If I have a file, I can get the icon by doing something such as:

NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile: @"myFile.png"];

But if I just wanted to get the icon for a specific file type (example the icon associated with png files, without having a "myFile.png" that already exists), i'm not sure how I can do that.

Any suggestions are appreciated!


Underneath -[NSWorkspace iconForFile:] in the documentation is -[NSWorkspace iconForFileType:]. Have you tried that?