ingham
ingham

Reputation: 1645

Get a file's icon or thumbnail

Is there a way, in OSX SDK, to represent a file in UI, by presenting its icon ? In other words, is it possible to access the icon for a specific file, to show it in a NSImageView for example ?

PS: I'm using MonoMac, but Objective-C code will certainly help me too :)

Thanks in advance

Upvotes: 2

Views: 2646

Answers (2)

daniel kilinskas
daniel kilinskas

Reputation: 3558

I used this category https://github.com/incbee/NSImage-QuickLook very helpful.

Upvotes: 0

Thomas Zoechling
Thomas Zoechling

Reputation: 34263

You can use NSWorkspace's iconForFile:
e.g.:

[[NSWorkspace sharedWorkspace] iconForFile:@"/Applications/Launchpad.app"];

If you need icons for a certain file type, you can use iconForFileType:

Upvotes: 9

Related Questions