views:

48

answers:

1

Hello everybody,

I got a TableView with a list of files in a directory. Now i want to add a colum with the file-thumbnails. How do i do this?

A: 

The icon of the file can be obtained by NSWorkspace's iconForFile:, see Apple doc on NSWorkspace.

To get the thumbnail, one uses one of the public function of the client side of QuickLook called QLThumbnailImageCreate, see Apple doc on QuickLook. Note that this is a CoreFoundation-type call, not a Cocoa method. If you're not used to CoreFoundation, read here.

Yuji
Alright it seems like the iconForFile is what i need. This is my code for updating my table with file information. Its here i want to add the icon: NSImage *fileThumb = [[NSWorkspace sharedWorkspace] iconForFile:sourceFile]; NSMutableDictionary *record = [[NSMutableDictionary alloc] init]; [record setObject:sourceFile forKey:@"tableFilename"]; [record setObject:@"Source" forKey:@"tableLocation"]; [record setObject:@"Source -> Destination" forKey:@"tableStatus"]; [tableRecords addObject:record]; [tableView reloadData]; [record autorelease];How?
s0mmer
post it as a separate question!
Yuji